Housekeeping

Preamble

By Katherine Duchesneau

We are working with the roots Lesion and Mycorrhiza dataset for now.

R details

This section contains all the necessary details about the R version and package version used to run this Notebook.

  • File creation date: 2018-02-05
  • R version 3.4.1 (2017-06-30)
  • tidyverse package version: 1.2.1
  • lme4 package version 1.1.13
  • MASS package version 7.3.47
  • MuMIn package version 1.15.6
  • emmeans package version 0.9.1
  • boot package version 1.3.20
  • brms package version 2.0.1
  • loo package version 1.1.0
  • fitdistrplus package version 1.0.9
  • mefa package version 3.2.7
  • library(devtools) and install_github("vqv/ggbiplot") package version 0.55
  • also requires rtools

Load Packages and Functions

library(tidyverse)
library(lme4)
library(MASS)
library(MuMIn)
library(emmeans)
library(boot)
library(brms)
library(loo)
library(fitdistrplus)
library(mefa)
library(ggbiplot)
library(pvclust)
library(vegan)
library(ggbiplot)

Load a custome theme for clean, readable graphs:

Overdispersion function, tests for overdispersion in GLMM:

Introducing the Data

Load/ Modify data: Co-occurence

## [1] 99.55752
## [1] 100
##      indiv2       None.Path           None.Myc           Herbivory      
##  10IAH1 :  100   Length:22500       Length:22500       Min.   :0.00000  
##  10IAH2 :  100   Class :character   Class :character   1st Qu.:0.00000  
##  10ISC1 :  100   Mode  :character   Mode  :character   Median :0.00000  
##  10ISC2 :  100                                         Mean   :0.03658  
##  10ISC3 :  100                                         3rd Qu.:0.00000  
##  10OAH1 :  100                                         Max.   :1.00000  
##  (Other):21900                                                          
##    None.Herb          Lesion        Mycorrhiza    
##  Min.   :0.0000   Min.   :0.000   Min.   :0.0000  
##  1st Qu.:1.0000   1st Qu.:0.000   1st Qu.:0.0000  
##  Median :1.0000   Median :1.000   Median :1.0000  
##  Mean   :0.9631   Mean   :0.622   Mean   :0.5732  
##  3rd Qu.:1.0000   3rd Qu.:1.000   3rd Qu.:1.0000  
##  Max.   :1.0000   Max.   :1.000   Max.   :1.0000  
## 
##     indiv2            None.Path        None.Myc        Herbivory      
##  Length:22500       Min.   :0.000   Min.   :0.0000   Min.   :0.00000  
##  Class :character   1st Qu.:0.000   1st Qu.:0.0000   1st Qu.:0.00000  
##  Mode  :character   Median :0.000   Median :0.0000   Median :0.00000  
##                     Mean   :0.378   Mean   :0.4268   Mean   :0.03658  
##                     3rd Qu.:1.000   3rd Qu.:1.0000   3rd Qu.:0.00000  
##                     Max.   :1.000   Max.   :1.0000   Max.   :1.00000  
##                                                                       
##    None.Herb          Lesion        Mycorrhiza          pop      
##  Min.   :0.0000   Min.   :0.000   Min.   :0.0000   5      :2900  
##  1st Qu.:1.0000   1st Qu.:0.000   1st Qu.:0.0000   7      :2600  
##  Median :1.0000   Median :1.000   Median :1.0000   8      :2600  
##  Mean   :0.9634   Mean   :0.622   Mean   :0.5732   3      :2200  
##  3rd Qu.:1.0000   3rd Qu.:1.000   3rd Qu.:1.0000   4      :2200  
##  Max.   :1.0000   Max.   :1.000   Max.   :1.0000   1      :2000  
##                                                    (Other):8000  
##  location  species  
##  I:10600   AH:3100  
##  O:11900   CL:3900  
##            GA:4900  
##            GR:1300  
##            MR:3100  
##            SC:6200  
## 
##     indiv2          None.Path None.Myc  Herbivory None.Herb Lesion   
##  Length:22500       0:13995   0:12897   0:21677   0:  823   0: 8505  
##  Class :character   1: 8505   1: 9603   1:  823   1:21677   1:13995  
##  Mode  :character                                                    
##                                                                      
##                                                                      
##                                                                      
##                                                                      
##  Mycorrhiza      pop       location  species  
##  0: 9603    5      :2900   I:10600   AH:3100  
##  1:12897    7      :2600   O:11900   CL:3900  
##             8      :2600             GA:4900  
##             3      :2200             GR:1300  
##             4      :2200             MR:3100  
##             1      :2000             SC:6200  
##             (Other):8000
## [1] 225

Load/ Modify data: Totals

## [1] 226
## [1] 226
##      indiv         Decay           Pathogen          Hyphae     
##  10IAH1 :  1   Min.   : 0.000   Min.   : 0.000   Min.   : 2.00  
##  10IAH2 :  1   1st Qu.: 1.000   1st Qu.: 2.000   1st Qu.:34.00  
##  10ISC1 :  1   Median : 4.000   Median : 4.000   Median :48.00  
##  10ISC2 :  1   Mean   : 7.894   Mean   : 7.168   Mean   :47.23  
##  10ISC3 :  1   3rd Qu.: 9.000   3rd Qu.:10.000   3rd Qu.:63.00  
##  10OAH1 :  1   Max.   :60.000   Max.   :86.000   Max.   :96.00  
##  (Other):220                                                    
##    None.Path       Arbuscules        Vesicles         M_Hyphae    
##  Min.   : 0.00   Min.   : 0.000   Min.   : 0.000   Min.   : 0.00  
##  1st Qu.:20.00   1st Qu.: 0.000   1st Qu.: 1.000   1st Qu.:30.25  
##  Median :33.00   Median : 0.000   Median : 6.000   Median :46.00  
##  Mean   :37.71   Mean   : 2.363   Mean   : 9.956   Mean   :45.16  
##  3rd Qu.:53.75   3rd Qu.: 3.000   3rd Qu.:14.000   3rd Qu.:61.00  
##  Max.   :97.00   Max.   :21.000   Max.   :73.000   Max.   :94.00  
##                                                                   
##     None.Myc        Herbivory        None.Herb           pop     location
##  Min.   :  0.00   Min.   : 0.000   Min.   : 62.00   5      :29   I:106   
##  1st Qu.: 18.00   1st Qu.: 0.000   1st Qu.: 96.00   8      :27   O:120   
##  Median : 38.50   Median : 1.000   Median : 99.00   7      :26           
##  Mean   : 42.52   Mean   : 3.624   Mean   : 96.38   3      :22           
##  3rd Qu.: 66.00   3rd Qu.: 4.000   3rd Qu.:100.00   4      :22           
##  Max.   :100.00   Max.   :38.000   Max.   :100.00   1      :20           
##                                                     (Other):80           
##  species
##  AH:31  
##  CL:39  
##  GA:50  
##  GR:13  
##  MR:31  
##  SC:62  
## 

Field survey data

FloristicSurvey <-read.csv("CSV/May_2017_FloristicSurvey_summer2016.csv", sep="\t")
PlantLength <- read.csv("CSV/May_2017_PlantLength_summer2016.csv", sep="\t")
Soil_characteristics <- read.csv("CSV/Soil_characteristics.txt", sep="\t")

#Restructuring
head(PlantLength)
str(PlantLength)
## 'data.frame':    231 obs. of  4 variables:
##  $ Pop         : int  14 14 14 14 14 14 14 14 14 14 ...
##  $ Location    : Factor w/ 2 levels "in","out": 2 2 2 2 2 1 1 1 1 1 ...
##  $ Species     : Factor w/ 7 levels "Acer_saccharum",..: 1 4 3 5 7 1 4 3 5 7 ...
##  $ Length_plant: num  14 87 20 12 67 11 65 51 20 100 ...
colnames(PlantLength)[1] <- "Population"
PlantLength$Population<-as.factor(PlantLength$Population)
PlantLength$Location<-as.factor(PlantLength$Location)

Root size

Root_size <-read.csv("CSV/Root_size.csv")

Variable descriptions

The variables are:

Co-occurence:

  • indiv2: The unique code given to a sample. In this dataset the unique sample code repeats 100 times for each cross where an observation was taken on the root sample.

  • None.Path: A binary representation of whether a sign of pathogen activity was recorded (0) or not (1).

  • Lesion: The counterpart to the previous variable (None.Path). A binary representation of whether a sign of pathogen activity was recorded (1) or not (0).

  • None.Myc: A binary representation of whether a sign of myccorhizal activity was recorded (0) or not (1).

  • Mycorrhiza: The counterpart to the previous variable (None.Myc). A binary representation of whether a sign of mycorrhizal activity was recorded (1) or not (0).

  • None.Herb: A binary representation of whether herbivory was recorded (0) or not (1).

  • Herbivory: The counterpart to the previous variable (None.Herb). A binary representation of whether Herbivoryn was recorded (1) or not (0).

  • Population (pop): The coding number representing the population at which the sample was collected.

  • location: A code representing the whether the sample was collected inside a Alliaria petiolata population (I) or whther it was collected at least 7 m outside of he furthest individual in the A. petiolata population (O).

  • species: The particular species to which the sample belongs.

  • Cross: The particular cross number where the data was recorded on the individual sample.

Total scores:

  • indiv: The unique code given to a sample.

  • Decay: The total number of crosses where decay was recorded an individual sample when doing a total of 100 crosses/ sample.

  • Pathogen: The total number of crosses where pathogen was recorded on an individual sample when doing a total of 100 crosses/ sample.

  • Hyphae: The total number of crosses where non-myccorhizal hyphae was recorded on an individual sample when doing a total of 100 crosses/ sample.

  • None.Path: The total number of crosses where no signs of pathogen activities were recorded on an individual sample when doing a total of 100 crosses/ sample. Note that the total of Decay, Pathogen, Hyphae, and None.Path must come to 100 per individual to account for all 100 crosses.

  • Arbuscule: The total number of crosses where an arbuscule was recorded on an individual sample when doing a total of 100 crosses/ sample.

  • Vesicules: The total number of crosses where a vesicule was recorded on an individual sample when doing a total of 100 crosses/ sample.

  • M_Hyphae: The total number of crosses where myccorhizal hyphae was recorded on an individual sample when doing a total of 100 crosses/ sample.

  • None.Myc: The total number of crosses where no signs of mycorrhizal activities were recorded on an individual sample when doing a total of 100 crosses/ sample. Note that the total of Arbuscules, Vesicules, M_Hyphae, and None.Myc must come to 100 per individual to account for all 100 crosses.

  • Herbivory: The total number of crosses where herbivory was recorded on an individual sample when doing a total of 100 crosses/ sample.

  • None.Herb: The total number of crosses where no signs of herbivory was recorded on an individual sample when doing a total of 100 crosses/ sample. Note that the total of Herbivory, and None.Herb must come to 100 per individual to account for all 100 crosses.

  • Population (pop): The coding number representing the population at which the sample was collected.

  • location: A code representing the whether the sample was collected inside a Alliaria petiolata population (I) or whther it was collected at least 7 m outside of he furthest individual in the A. petiolata population (O).

  • species: The particular species to which the sample belongs.

Reviewing of hypotheses:

Question 1: Is there evidence that Mycorrhizal colonization provides protection against root pathogen damage?

Question 2: Do these effects vary among species?

Hypothesis 1

Mycorrhizal colonization protects roots from lesions and herbivory.

Hypothesis 2

A. petiolata invasion reduces mycorrhizal colonization and increases pathogen colonization and herbivory ### Hypothesis 3

Cycorrhizal colonization is reduced in the presence of A. petiolata

Hypothesis 4

Mycorrhizal protection is completely lost in the presence of A. petiolata

Molecular data Hypothesis

Hypothesis 1

A. petiolata invasion changes the diversity of mycorrhizal and other fungal species present in the soil.

I will find that the molecular data from the soil extraction supports this claim by having a reduced biodiversity and abundance of mycorrhiza in samples taken inside A. petiolata populations.

Hypothesis 2

There will be a negative correlation between mycorrhizal and fungal pathogen diversity.

Field Data Analysis

Plant length and GM presence

mod1<-PlantLength$Length_plant~PlantLength$Location+(1|PlantLength$Species)+(1|PlantLength$Population)
row.has.na <- apply(PlantLength, 1, function(x){any(is.na(x))})
sum(row.has.na) 
## [1] 2
PlantLength.filtered <- PlantLength[!row.has.na,]# Removed all the rows with NAs

mod1<-lmer(log(PlantLength.filtered$Length_plant)~PlantLength.filtered$Location+(1|PlantLength.filtered$Species)+(1|PlantLength.filtered$Population))
mod2<-lmer(log(PlantLength.filtered$Length_plant)~PlantLength.filtered$Location+(1|PlantLength.filtered$Species))
mod3<-lmer(log(PlantLength.filtered$Length_plant)~1+(1|PlantLength.filtered$Species)+(1|PlantLength.filtered$Population))
# Made these three models, one is all of them, one no population, and one no in/ out
summary(mod1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: 
## log(PlantLength.filtered$Length_plant) ~ PlantLength.filtered$Location +  
##     (1 | PlantLength.filtered$Species) + (1 | PlantLength.filtered$Population)
## 
## REML criterion at convergence: 171.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1893 -0.6544 -0.0228  0.5866  2.5454 
## 
## Random effects:
##  Groups                          Name        Variance Std.Dev.
##  PlantLength.filtered$Species    (Intercept) 0.298185 0.54606 
##  PlantLength.filtered$Population (Intercept) 0.007485 0.08652 
##  Residual                                    0.102984 0.32091 
## Number of obs: 229, groups:  
## PlantLength.filtered$Species, 7; PlantLength.filtered$Population, 7
## 
## Fixed effects:
##                                  Estimate Std. Error t value
## (Intercept)                       3.18352    0.21134  15.064
## PlantLength.filtered$Locationout -0.08492    0.04254  -1.996
## 
## Correlation of Fixed Effects:
##             (Intr)
## PlntLngt.$L -0.106
anova(mod1,mod2) # One ANOVA with model 1, one with model 2 to compare if they are statistically significantly different from each other
## refitting model(s) with ML (instead of REML)
qplot(predict(mod1),log(PlantLength.filtered$Length_plant)) #is this model normal? NO

qplot(predict(mod1),log(PlantLength.filtered$Length_plant)-predict(mod1)) # Make this model normal by log() the y variable.

cor(predict(mod1),PlantLength.filtered$Length_plant)^2 # Are the correlation coefficients meaningful?
## [1] 0.6185216
cor(predict(mod2),PlantLength.filtered$Length_plant)^2 # Are the correlation coefficients meaningful wihout pops?
## [1] 0.5985089
anova(mod1,mod3) # Repeat with a model without the in/ out component.
## refitting model(s) with ML (instead of REML)
cor(predict(mod3),PlantLength.filtered$Length_plant)^2 # how much different does it make when we consider GM?
## [1] 0.608331

Floristic composition and GM presence

colnames(FloristicSurvey)[1] <- "Population" # population loads in weirdly, I am just arranging it to not have quotes around. so odd
FloristicSurvey$Population<-as.factor(FloristicSurvey$Population) # Make the population a factor and not an interger
FloristicSurvey[is.na(FloristicSurvey)] <- 0
sum(row.has.na <- apply(FloristicSurvey, 1, function(x){any(is.na(x))}))
## [1] 0
# Start the PCA
PC <- prcomp(FloristicSurvey[,4:ncol(FloristicSurvey)], center=T)
summary(PC)
## Importance of components%s:
##                           PC1    PC2     PC3     PC4     PC5    PC6
## Standard deviation     0.6406 0.5639 0.49314 0.45065 0.42882 0.3954
## Proportion of Variance 0.1365 0.1058 0.08088 0.06755 0.06116 0.0520
## Cumulative Proportion  0.1365 0.2422 0.32311 0.39066 0.45182 0.5038
##                            PC7    PC8     PC9    PC10    PC11    PC12
## Standard deviation     0.37368 0.3608 0.34564 0.33141 0.30059 0.27972
## Proportion of Variance 0.04644 0.0433 0.03974 0.03653 0.03005 0.02602
## Cumulative Proportion  0.55027 0.5936 0.63330 0.66983 0.69989 0.72591
##                           PC13    PC14    PC15    PC16    PC17   PC18
## Standard deviation     0.26731 0.23707 0.23511 0.23170 0.23140 0.2159
## Proportion of Variance 0.02377 0.01869 0.01839 0.01786 0.01781 0.0155
## Cumulative Proportion  0.74968 0.76837 0.78675 0.80461 0.82242 0.8379
##                           PC19   PC20   PC21    PC22    PC23    PC24
## Standard deviation     0.20362 0.1992 0.1835 0.17727 0.17130 0.16138
## Proportion of Variance 0.01379 0.0132 0.0112 0.01045 0.00976 0.00866
## Cumulative Proportion  0.85171 0.8649 0.8761 0.88656 0.89632 0.90499
##                           PC25    PC26    PC27    PC28    PC29    PC30
## Standard deviation     0.16000 0.15304 0.14850 0.14015 0.13172 0.12966
## Proportion of Variance 0.00851 0.00779 0.00733 0.00653 0.00577 0.00559
## Cumulative Proportion  0.91350 0.92129 0.92863 0.93516 0.94093 0.94652
##                           PC31    PC32    PC33    PC34    PC35    PC36
## Standard deviation     0.12335 0.11774 0.11421 0.11329 0.10677 0.10455
## Proportion of Variance 0.00506 0.00461 0.00434 0.00427 0.00379 0.00364
## Cumulative Proportion  0.95158 0.95619 0.96053 0.96480 0.96859 0.97223
##                           PC37    PC38    PC39    PC40    PC41    PC42
## Standard deviation     0.10160 0.09716 0.09407 0.08205 0.07828 0.07736
## Proportion of Variance 0.00343 0.00314 0.00294 0.00224 0.00204 0.00199
## Cumulative Proportion  0.97566 0.97880 0.98174 0.98398 0.98602 0.98801
##                           PC43    PC44    PC45    PC46    PC47    PC48
## Standard deviation     0.07252 0.06984 0.06822 0.06603 0.06268 0.05955
## Proportion of Variance 0.00175 0.00162 0.00155 0.00145 0.00131 0.00118
## Cumulative Proportion  0.98976 0.99138 0.99293 0.99438 0.99569 0.99687
##                           PC49    PC50    PC51      PC52
## Standard deviation     0.05928 0.05691 0.05170 4.972e-17
## Proportion of Variance 0.00117 0.00108 0.00089 0.000e+00
## Cumulative Proportion  0.99803 0.99911 1.00000 1.000e+00
screeplot(PC)

# Variation explaination
100*sum(summary(PC)[[1]][1])/sum(summary(PC)[[1]]) #explained by just PC1
## [1] 6.330025
100*sum(summary(PC)[[1]][1:2])/sum(summary(PC)[[1]])#explained by PC1 and PC2
## [1] 11.90248
n=25
100*sum(summary(PC)[[1]][1:n])/sum(summary(PC)[[1]])
## [1] 75.49034

Linear discriminate analysis

# Discriminant function analysis is used (general LDA format) because i have a cat. dependent and a binary independent. (it needs binary or continuous!)
# you might have to bin covers because it only works with categorical, so 0-5% none, 6-40 low etc.
FloristicSurvey$GM_Coverage_category<-cut(FloristicSurvey$GM_Coverage, c(-Inf,20,50,80,100), labels = c("None", "Med_Low", "Med_High", "Overtaken"))
table(FloristicSurvey$GM_Coverage_category)
## 
##      None   Med_Low  Med_High Overtaken 
##        80        26        72        20
# [0-20] None
# ]20-50] Medium low
# ]50-80] Medium high
# ]80-100] Overtaken

LDA

#LDA
FloristicSurveysmall<-data.frame(FloristicSurvey[,4:56])
# Linear discriminant function analysis

FloristicSurveysmall <- FloristicSurveysmall[,-c(42,45)] 
FloristicSurveyLDA <- lda(GM_Coverage_category ~., data=FloristicSurveysmall)
# Extract scaling vectors
scalvec<-data.frame(FloristicSurveyLDA$scaling)
# Extract predictions
FloristicSurveyLDAval <- data.frame(predict(FloristicSurveyLDA)$x)

# Plot results
ggplot(data=FloristicSurveyLDAval,aes(x=LD1, y=LD2, group=FloristicSurveysmall$GM_Coverage_category))+
  stat_ellipse(geom="polygon",aes(colour=FloristicSurveysmall$GM_Coverage_category),fill=NA,size=1.2,alpha=0.3)+
  stat_ellipse(geom="polygon",aes(fill=FloristicSurveysmall$GM_Coverage_category,colour=FloristicSurveysmall$GM_Coverage_category),size=1.2,alpha=0.3)+
  geom_point(aes(shape=FloristicSurveysmall$GM_Coverage_category,fill=FloristicSurveysmall$GM_Coverage_category,colour=FloristicSurveysmall$GM_Coverage_category),size=I(4),alpha=I(0.8))+
  xlab("LD Axis 1")+ylab("LD Axis 2")+theme_simple() +
  theme(legend.title=element_blank())

#test significance of axis
anova(lm(FloristicSurveyLDAval$LD1~FloristicSurveysmall$GM_Coverage_category))
anova(lm(FloristicSurveyLDAval$LD2~FloristicSurveysmall$GM_Coverage_category))
#LDA WITHOUT A. PETIOLATA
FloristicSurveysmall<-data.frame(FloristicSurvey[,4:56])
# Linear discriminant function analysis
FloristicSurveysmall[10]<-NULL
FloristicSurveysmall[c(41,44)] <- NULL 
FloristicSurveyLDA<-lda(GM_Coverage_category ~ ., data=FloristicSurveysmall)
# Extract scaling vectors
scalvec<-data.frame(FloristicSurveyLDA$scaling)
# Extract predictions
FloristicSurveyLDAval <- data.frame(predict(FloristicSurveyLDA)$x)

# Plot results
ggplot(data=FloristicSurveyLDAval,aes(x=LD1,y=LD2,group=FloristicSurveysmall$GM_Coverage_category))+
  stat_ellipse(geom="polygon",aes(colour=FloristicSurveysmall$GM_Coverage_category),fill=NA,size=1.2,alpha=0.3)+
  stat_ellipse(geom="polygon",aes(fill=FloristicSurveysmall$GM_Coverage_category,colour=FloristicSurveysmall$GM_Coverage_category),size=1.2,alpha=0.3)+
  geom_point(aes(shape=FloristicSurveysmall$GM_Coverage_category,fill=FloristicSurveysmall$GM_Coverage_category,colour=FloristicSurveysmall$GM_Coverage_category),size=I(4),alpha=I(0.8))+
  xlab("LD Axis 1")+ylab("LD Axis 2")+theme_simple() +
  theme(legend.title=element_blank())

#test significance of axis
anova(lm(FloristicSurveyLDAval$LD1~FloristicSurveysmall$GM_Coverage_category))
anova(lm(FloristicSurveyLDAval$LD2~FloristicSurveysmall$GM_Coverage_category))

Cluster analysis

# Ward Hierarchical Clustering with Bootstrapped p values
#do they cluster by population?
FloristicSurvey[is.na(FloristicSurvey)] <- 0
mydata<-t(data.frame(FloristicSurvey[,1],FloristicSurvey[,4:55]))
my.names <- mydata[1,]
colnames(mydata) <- my.names
mydata <- mydata[-1,]
d <- dist(t(mydata), method = "euclidean") # distance matrix
fit <- hclust(d, method = "ward.D")
plot(fit) 

#do they cluster by GM coverage?
FloristicSurvey[is.na(FloristicSurvey)] <- 0
#this will just make the dendogram easier to see
FloristicSurvey$GM_Coverage_category<-cut(FloristicSurvey$GM_Coverage, c(-Inf,5,30,50,70,95,100), labels = c("N", "L", "ML", "MH", "H", "F"))
mydata<-t(data.frame(FloristicSurvey[,56],FloristicSurvey[,4:55]))
my.names <- mydata[1,]
colnames(mydata) <- my.names
mydata <- mydata[-1,]
d <- dist(t(mydata), method = "euclidean") # distance matrix
fit <- hclust(d, method = "ward.D")
plot(fit) 

FloristicSurvey$GM_Coverage_category<-cut(FloristicSurvey$GM_Coverage, c(-Inf,5,30,50,70,95,100), labels = c("None", "Low", "Med_Low", "Med_High", "High", "Overtaken"))

NMDS

# https://jonlefcheck.net/2012/10/24/nmds-tutorial-in-r/
# https://oliviarata.wordpress.com/2014/04/17/ordinations-in-ggplot2/
#Make a matrix with no row or column equal to 0 (do not enclude the env variable (GM COVERAGE))
M <- as.matrix(FloristicSurvey[1:198,4:55])
M[is.na(M)] <- 0
rownames(M) <- FloristicSurvey$Population
which( colSums(M)==0 )
## Carpinus_carolinia 
##                 45
which( rowSums(M)==0 )
##   3   3 
## 130 133
#Now that you know which column must be taken out, redo the matrix but with the last column, then remove the rows and columns =0
#I did this because the previous method doesnt work with the characters in the GM_COVERAGE column.
M <- as.matrix(FloristicSurvey[1:198,4:56])
M[is.na(M)] <- 0
rownames(M) <- FloristicSurvey$Population
M<-M[,-45]
M<-M[-130,]
M<-M[-133,]
M<-M[-132,]
# Now I'll make the env column a vector on its own, but the previous colde now allows it to be in the same order as the matrix im using for distances.
GM_coverage_df <- data.frame(M[,52])
M<-M[,-52]
class(M) <- "numeric"
# with vegdist from Bray to seroeson: add binary = T 
dist_FloristicSurvey <- vegdist(M, method = "bray", binary = T)
#The metaMDS analysis could have done the distance matrix internally but i would rather control it since i have presence/abscence
meta.nmds.FloristicSurvey <- metaMDS(dist_FloristicSurvey)
## Run 0 stress 0.2097786 
## Run 1 stress 0.2118606 
## Run 2 stress 0.2097164 
## ... New best solution
## ... Procrustes: rmse 0.00524235  max resid 0.04177558 
## Run 3 stress 0.2170078 
## Run 4 stress 0.2284479 
## Run 5 stress 0.2096598 
## ... New best solution
## ... Procrustes: rmse 0.005245703  max resid 0.05602814 
## Run 6 stress 0.2098256 
## ... Procrustes: rmse 0.01231086  max resid 0.1151435 
## Run 7 stress 0.2170353 
## Run 8 stress 0.2153965 
## Run 9 stress 0.2116358 
## Run 10 stress 0.2098729 
## ... Procrustes: rmse 0.01331197  max resid 0.1361556 
## Run 11 stress 0.215148 
## Run 12 stress 0.2098735 
## ... Procrustes: rmse 0.01263268  max resid 0.126724 
## Run 13 stress 0.2116845 
## Run 14 stress 0.2102258 
## Run 15 stress 0.2126313 
## Run 16 stress 0.2131586 
## Run 17 stress 0.2131855 
## Run 18 stress 0.2112311 
## Run 19 stress 0.2096905 
## ... Procrustes: rmse 0.009321867  max resid 0.1029974 
## Run 20 stress 0.2132274 
## *** No convergence -- monoMDS stopping criteria:
##      2: no. of iterations >= maxit
##     18: stress ratio > sratmax
# Non convergence with only 20 tries. lets increase that then
meta.nmds.FloristicSurvey2D <- metaMDS(dist_FloristicSurvey, k=2, trymax = 1000)
## Run 0 stress 0.2097786 
## Run 1 stress 0.2112547 
## Run 2 stress 0.2106852 
## Run 3 stress 0.2208225 
## Run 4 stress 0.2137372 
## Run 5 stress 0.2097392 
## ... New best solution
## ... Procrustes: rmse 0.00718742  max resid 0.0798187 
## Run 6 stress 0.2124989 
## Run 7 stress 0.2129202 
## Run 8 stress 0.2137635 
## Run 9 stress 0.2128476 
## Run 10 stress 0.2125806 
## Run 11 stress 0.2159597 
## Run 12 stress 0.2103 
## Run 13 stress 0.2098758 
## ... Procrustes: rmse 0.009408093  max resid 0.1140905 
## Run 14 stress 0.2145927 
## Run 15 stress 0.2101736 
## ... Procrustes: rmse 0.01217769  max resid 0.1131686 
## Run 16 stress 0.2103604 
## Run 17 stress 0.2182715 
## Run 18 stress 0.213402 
## Run 19 stress 0.2123159 
## Run 20 stress 0.2097852 
## ... Procrustes: rmse 0.005363804  max resid 0.05336445 
## Run 21 stress 0.2098657 
## ... Procrustes: rmse 0.009261906  max resid 0.1139693 
## Run 22 stress 0.2101252 
## ... Procrustes: rmse 0.009937061  max resid 0.09772294 
## Run 23 stress 0.2098159 
## ... Procrustes: rmse 0.009148565  max resid 0.1038414 
## Run 24 stress 0.2097 
## ... New best solution
## ... Procrustes: rmse 0.009823185  max resid 0.1036899 
## Run 25 stress 0.2097555 
## ... Procrustes: rmse 0.00814418  max resid 0.05827887 
## Run 26 stress 0.2098755 
## ... Procrustes: rmse 0.01357467  max resid 0.131995 
## Run 27 stress 0.2404572 
## Run 28 stress 0.2126283 
## Run 29 stress 0.2100543 
## ... Procrustes: rmse 0.007655709  max resid 0.07207129 
## Run 30 stress 0.2123402 
## Run 31 stress 0.2097392 
## ... Procrustes: rmse 0.009641298  max resid 0.09381109 
## Run 32 stress 0.212052 
## Run 33 stress 0.2211139 
## Run 34 stress 0.2101338 
## ... Procrustes: rmse 0.008308897  max resid 0.07134837 
## Run 35 stress 0.2147648 
## Run 36 stress 0.2125887 
## Run 37 stress 0.2100535 
## ... Procrustes: rmse 0.007949393  max resid 0.07306144 
## Run 38 stress 0.2125138 
## Run 39 stress 0.2129366 
## Run 40 stress 0.209854 
## ... Procrustes: rmse 0.0118158  max resid 0.1315827 
## Run 41 stress 0.2102893 
## Run 42 stress 0.2126057 
## Run 43 stress 0.2126647 
## Run 44 stress 0.2176834 
## Run 45 stress 0.2130861 
## Run 46 stress 0.2101638 
## ... Procrustes: rmse 0.01251173  max resid 0.1318302 
## Run 47 stress 0.2102679 
## Run 48 stress 0.2268205 
## Run 49 stress 0.213238 
## Run 50 stress 0.2098203 
## ... Procrustes: rmse 0.008258257  max resid 0.1069386 
## Run 51 stress 0.2137654 
## Run 52 stress 0.2328722 
## Run 53 stress 0.2101857 
## ... Procrustes: rmse 0.01257772  max resid 0.1318834 
## Run 54 stress 0.2133752 
## Run 55 stress 0.2097745 
## ... Procrustes: rmse 0.00464716  max resid 0.04011453 
## Run 56 stress 0.2097129 
## ... Procrustes: rmse 0.003910772  max resid 0.03913292 
## Run 57 stress 0.2105312 
## Run 58 stress 0.2129527 
## Run 59 stress 0.2126595 
## Run 60 stress 0.2147367 
## Run 61 stress 0.2132329 
## Run 62 stress 0.2126129 
## Run 63 stress 0.2129796 
## Run 64 stress 0.213264 
## Run 65 stress 0.2125993 
## Run 66 stress 0.2184764 
## Run 67 stress 0.2098263 
## ... Procrustes: rmse 0.009298469  max resid 0.1112046 
## Run 68 stress 0.2158228 
## Run 69 stress 0.2102315 
## Run 70 stress 0.2097987 
## ... Procrustes: rmse 0.01109859  max resid 0.1010329 
## Run 71 stress 0.209743 
## ... Procrustes: rmse 0.005797137  max resid 0.05459101 
## Run 72 stress 0.212585 
## Run 73 stress 0.20984 
## ... Procrustes: rmse 0.0102877  max resid 0.1313941 
## Run 74 stress 0.2098864 
## ... Procrustes: rmse 0.01390775  max resid 0.1319615 
## Run 75 stress 0.2098763 
## ... Procrustes: rmse 0.0138568  max resid 0.1320641 
## Run 76 stress 0.2098847 
## ... Procrustes: rmse 0.01406611  max resid 0.1320731 
## Run 77 stress 0.2102713 
## Run 78 stress 0.2096615 
## ... New best solution
## ... Procrustes: rmse 0.00692062  max resid 0.06139185 
## Run 79 stress 0.2102652 
## Run 80 stress 0.2185419 
## Run 81 stress 0.2116849 
## Run 82 stress 0.2217371 
## Run 83 stress 0.2131764 
## Run 84 stress 0.210468 
## Run 85 stress 0.2147203 
## Run 86 stress 0.2102534 
## Run 87 stress 0.2117 
## Run 88 stress 0.2134446 
## Run 89 stress 0.2161576 
## Run 90 stress 0.2133052 
## Run 91 stress 0.2125821 
## Run 92 stress 0.2160688 
## Run 93 stress 0.2098391 
## ... Procrustes: rmse 0.01124941  max resid 0.1243449 
## Run 94 stress 0.212599 
## Run 95 stress 0.2162705 
## Run 96 stress 0.2101667 
## Run 97 stress 0.2131857 
## Run 98 stress 0.2098331 
## ... Procrustes: rmse 0.009016082  max resid 0.1087286 
## Run 99 stress 0.2098283 
## ... Procrustes: rmse 0.01035589  max resid 0.1090343 
## Run 100 stress 0.2408432 
## Run 101 stress 0.209785 
## ... Procrustes: rmse 0.01258053  max resid 0.1041663 
## Run 102 stress 0.2191005 
## Run 103 stress 0.2097177 
## ... Procrustes: rmse 0.009468118  max resid 0.1010864 
## Run 104 stress 0.2341083 
## Run 105 stress 0.2096595 
## ... New best solution
## ... Procrustes: rmse 0.002154158  max resid 0.01498952 
## Run 106 stress 0.2096704 
## ... Procrustes: rmse 0.002439552  max resid 0.02310321 
## Run 107 stress 0.2133437 
## Run 108 stress 0.2101521 
## ... Procrustes: rmse 0.0141137  max resid 0.1179521 
## Run 109 stress 0.2116398 
## Run 110 stress 0.2155292 
## Run 111 stress 0.2098694 
## ... Procrustes: rmse 0.01248518  max resid 0.1157408 
## Run 112 stress 0.2098212 
## ... Procrustes: rmse 0.01237132  max resid 0.1141917 
## Run 113 stress 0.2098833 
## ... Procrustes: rmse 0.01397455  max resid 0.1356434 
## Run 114 stress 0.2129437 
## Run 115 stress 0.2129436 
## Run 116 stress 0.2129478 
## Run 117 stress 0.22287 
## Run 118 stress 0.222658 
## Run 119 stress 0.2098166 
## ... Procrustes: rmse 0.01018018  max resid 0.1069602 
## Run 120 stress 0.2116581 
## Run 121 stress 0.2114843 
## Run 122 stress 0.2274623 
## Run 123 stress 0.2098432 
## ... Procrustes: rmse 0.01016995  max resid 0.1125837 
## Run 124 stress 0.2127465 
## Run 125 stress 0.2132876 
## Run 126 stress 0.2098845 
## ... Procrustes: rmse 0.01314707  max resid 0.1138003 
## Run 127 stress 0.2124702 
## Run 128 stress 0.2102241 
## Run 129 stress 0.2098111 
## ... Procrustes: rmse 0.0124448  max resid 0.1081653 
## Run 130 stress 0.2122607 
## Run 131 stress 0.2097514 
## ... Procrustes: rmse 0.005914794  max resid 0.04919618 
## Run 132 stress 0.2126467 
## Run 133 stress 0.2102318 
## Run 134 stress 0.2125883 
## Run 135 stress 0.2125245 
## Run 136 stress 0.209883 
## ... Procrustes: rmse 0.01390443  max resid 0.1327541 
## Run 137 stress 0.2098289 
## ... Procrustes: rmse 0.01112621  max resid 0.1195904 
## Run 138 stress 0.2097547 
## ... Procrustes: rmse 0.009033129  max resid 0.09424316 
## Run 139 stress 0.2133042 
## Run 140 stress 0.2102747 
## Run 141 stress 0.2210968 
## Run 142 stress 0.2117293 
## Run 143 stress 0.2098413 
## ... Procrustes: rmse 0.0102687  max resid 0.1130007 
## Run 144 stress 0.2103063 
## Run 145 stress 0.2096866 
## ... Procrustes: rmse 0.004358966  max resid 0.03396607 
## Run 146 stress 0.210277 
## Run 147 stress 0.2098094 
## ... Procrustes: rmse 0.009552282  max resid 0.1130953 
## Run 148 stress 0.212472 
## Run 149 stress 0.2147029 
## Run 150 stress 0.214714 
## Run 151 stress 0.2145465 
## Run 152 stress 0.2098661 
## ... Procrustes: rmse 0.01131578  max resid 0.1217265 
## Run 153 stress 0.2146002 
## Run 154 stress 0.2145566 
## Run 155 stress 0.2101102 
## ... Procrustes: rmse 0.006767511  max resid 0.07401685 
## Run 156 stress 0.2371128 
## Run 157 stress 0.210163 
## Run 158 stress 0.2098206 
## ... Procrustes: rmse 0.01223709  max resid 0.09602246 
## Run 159 stress 0.2129292 
## Run 160 stress 0.2107412 
## Run 161 stress 0.2124858 
## Run 162 stress 0.2102685 
## Run 163 stress 0.2270066 
## Run 164 stress 0.2097383 
## ... Procrustes: rmse 0.01071446  max resid 0.09918804 
## Run 165 stress 0.2098324 
## ... Procrustes: rmse 0.01338536  max resid 0.1280022 
## Run 166 stress 0.2098701 
## ... Procrustes: rmse 0.01183182  max resid 0.1139977 
## Run 167 stress 0.2097087 
## ... Procrustes: rmse 0.009726719  max resid 0.09846339 
## Run 168 stress 0.2133348 
## Run 169 stress 0.2131409 
## Run 170 stress 0.2144718 
## Run 171 stress 0.2103159 
## Run 172 stress 0.2116966 
## Run 173 stress 0.2102693 
## Run 174 stress 0.2102952 
## Run 175 stress 0.2098208 
## ... Procrustes: rmse 0.01305643  max resid 0.1247709 
## Run 176 stress 0.2145722 
## Run 177 stress 0.2101819 
## Run 178 stress 0.2098768 
## ... Procrustes: rmse 0.01373789  max resid 0.1330559 
## Run 179 stress 0.2125205 
## Run 180 stress 0.2124703 
## Run 181 stress 0.2130273 
## Run 182 stress 0.209707 
## ... Procrustes: rmse 0.009498164  max resid 0.09529352 
## Run 183 stress 0.2116569 
## Run 184 stress 0.2097131 
## ... Procrustes: rmse 0.008514103  max resid 0.09394618 
## Run 185 stress 0.2098283 
## ... Procrustes: rmse 0.01010459  max resid 0.09303508 
## Run 186 stress 0.2216702 
## Run 187 stress 0.2125068 
## Run 188 stress 0.2097955 
## ... Procrustes: rmse 0.01060585  max resid 0.09446631 
## Run 189 stress 0.2126627 
## Run 190 stress 0.2102923 
## Run 191 stress 0.2097287 
## ... Procrustes: rmse 0.01065612  max resid 0.09915962 
## Run 192 stress 0.2138963 
## Run 193 stress 0.2150085 
## Run 194 stress 0.2097952 
## ... Procrustes: rmse 0.01241158  max resid 0.1063897 
## Run 195 stress 0.2148653 
## Run 196 stress 0.2098759 
## ... Procrustes: rmse 0.01379914  max resid 0.1313082 
## Run 197 stress 0.2097728 
## ... Procrustes: rmse 0.01295433  max resid 0.1173216 
## Run 198 stress 0.216412 
## Run 199 stress 0.2101222 
## ... Procrustes: rmse 0.006336903  max resid 0.07082034 
## Run 200 stress 0.2098156 
## ... Procrustes: rmse 0.009739231  max resid 0.1128243 
## Run 201 stress 0.2101529 
## ... Procrustes: rmse 0.01085461  max resid 0.1133122 
## Run 202 stress 0.2098338 
## ... Procrustes: rmse 0.01352807  max resid 0.1268205 
## Run 203 stress 0.2134306 
## Run 204 stress 0.2348275 
## Run 205 stress 0.2181281 
## Run 206 stress 0.2101332 
## ... Procrustes: rmse 0.007423958  max resid 0.06933705 
## Run 207 stress 0.2097556 
## ... Procrustes: rmse 0.008710169  max resid 0.1053688 
## Run 208 stress 0.2098128 
## ... Procrustes: rmse 0.009889361  max resid 0.08868194 
## Run 209 stress 0.2097604 
## ... Procrustes: rmse 0.007904933  max resid 0.1039547 
## Run 210 stress 0.2120793 
## Run 211 stress 0.2145861 
## Run 212 stress 0.2098325 
## ... Procrustes: rmse 0.01209831  max resid 0.126562 
## Run 213 stress 0.2136885 
## Run 214 stress 0.2116336 
## Run 215 stress 0.2165315 
## Run 216 stress 0.2129949 
## Run 217 stress 0.2098327 
## ... Procrustes: rmse 0.009456267  max resid 0.1125347 
## Run 218 stress 0.212464 
## Run 219 stress 0.2099212 
## ... Procrustes: rmse 0.01503589  max resid 0.1498609 
## Run 220 stress 0.2148993 
## Run 221 stress 0.2177464 
## Run 222 stress 0.210159 
## ... Procrustes: rmse 0.01060139  max resid 0.1134212 
## Run 223 stress 0.2174341 
## Run 224 stress 0.2099154 
## ... Procrustes: rmse 0.01357  max resid 0.1255281 
## Run 225 stress 0.2102486 
## Run 226 stress 0.21015 
## ... Procrustes: rmse 0.01060009  max resid 0.09778667 
## Run 227 stress 0.2101093 
## ... Procrustes: rmse 0.007302969  max resid 0.07441789 
## Run 228 stress 0.2215797 
## Run 229 stress 0.2101241 
## ... Procrustes: rmse 0.01085933  max resid 0.09926067 
## Run 230 stress 0.2116692 
## Run 231 stress 0.212948 
## Run 232 stress 0.2098658 
## ... Procrustes: rmse 0.01332571  max resid 0.123943 
## Run 233 stress 0.2131357 
## Run 234 stress 0.2120361 
## Run 235 stress 0.2130986 
## Run 236 stress 0.2132177 
## Run 237 stress 0.2142634 
## Run 238 stress 0.2099454 
## ... Procrustes: rmse 0.0156032  max resid 0.1616617 
## Run 239 stress 0.2098363 
## ... Procrustes: rmse 0.01142511  max resid 0.1254833 
## Run 240 stress 0.2098223 
## ... Procrustes: rmse 0.01041371  max resid 0.1063697 
## Run 241 stress 0.2102743 
## Run 242 stress 0.2116766 
## Run 243 stress 0.209737 
## ... Procrustes: rmse 0.0102401  max resid 0.09836793 
## Run 244 stress 0.2144918 
## Run 245 stress 0.2102505 
## Run 246 stress 0.210156 
## ... Procrustes: rmse 0.006894339  max resid 0.07425289 
## Run 247 stress 0.2150163 
## Run 248 stress 0.2113171 
## Run 249 stress 0.2125603 
## Run 250 stress 0.212469 
## Run 251 stress 0.2103005 
## Run 252 stress 0.2096833 
## ... Procrustes: rmse 0.01055223  max resid 0.09897283 
## Run 253 stress 0.2097074 
## ... Procrustes: rmse 0.009676704  max resid 0.09870454 
## Run 254 stress 0.2098003 
## ... Procrustes: rmse 0.013757  max resid 0.1205736 
## Run 255 stress 0.2102656 
## Run 256 stress 0.210165 
## Run 257 stress 0.2325592 
## Run 258 stress 0.2144453 
## Run 259 stress 0.2125992 
## Run 260 stress 0.2100826 
## ... Procrustes: rmse 0.00688639  max resid 0.07421719 
## Run 261 stress 0.2137323 
## Run 262 stress 0.211697 
## Run 263 stress 0.2131812 
## Run 264 stress 0.2134174 
## Run 265 stress 0.2101908 
## Run 266 stress 0.2128276 
## Run 267 stress 0.209868 
## ... Procrustes: rmse 0.009805803  max resid 0.1118901 
## Run 268 stress 0.2172628 
## Run 269 stress 0.2124935 
## Run 270 stress 0.2133038 
## Run 271 stress 0.2098258 
## ... Procrustes: rmse 0.01183162  max resid 0.1212858 
## Run 272 stress 0.2148531 
## Run 273 stress 0.2353518 
## Run 274 stress 0.2132302 
## Run 275 stress 0.2098314 
## ... Procrustes: rmse 0.01122061  max resid 0.09745725 
## Run 276 stress 0.2156803 
## Run 277 stress 0.2129808 
## Run 278 stress 0.2098189 
## ... Procrustes: rmse 0.01194281  max resid 0.09562509 
## Run 279 stress 0.2159205 
## Run 280 stress 0.2116672 
## Run 281 stress 0.2102496 
## Run 282 stress 0.2132452 
## Run 283 stress 0.2100655 
## ... Procrustes: rmse 0.006814578  max resid 0.07312236 
## Run 284 stress 0.2261394 
## Run 285 stress 0.214567 
## Run 286 stress 0.2098865 
## ... Procrustes: rmse 0.01355715  max resid 0.1216802 
## Run 287 stress 0.2130743 
## Run 288 stress 0.2105431 
## Run 289 stress 0.2121655 
## Run 290 stress 0.2174596 
## Run 291 stress 0.2133528 
## Run 292 stress 0.2129535 
## Run 293 stress 0.2101171 
## ... Procrustes: rmse 0.006708617  max resid 0.07453036 
## Run 294 stress 0.2235368 
## Run 295 stress 0.2101417 
## ... Procrustes: rmse 0.01129196  max resid 0.09899071 
## Run 296 stress 0.2096765 
## ... Procrustes: rmse 0.01015127  max resid 0.09877341 
## Run 297 stress 0.2102547 
## Run 298 stress 0.2253775 
## Run 299 stress 0.2147179 
## Run 300 stress 0.2169003 
## Run 301 stress 0.2157152 
## Run 302 stress 0.2103062 
## Run 303 stress 0.2102764 
## Run 304 stress 0.2149669 
## Run 305 stress 0.2097999 
## ... Procrustes: rmse 0.01148881  max resid 0.1102647 
## Run 306 stress 0.210273 
## Run 307 stress 0.2114726 
## Run 308 stress 0.2103055 
## Run 309 stress 0.2130008 
## Run 310 stress 0.209774 
## ... Procrustes: rmse 0.01071688  max resid 0.1322148 
## Run 311 stress 0.2102439 
## Run 312 stress 0.2238459 
## Run 313 stress 0.2101094 
## ... Procrustes: rmse 0.006316446  max resid 0.07323169 
## Run 314 stress 0.2161524 
## Run 315 stress 0.212902 
## Run 316 stress 0.2121924 
## Run 317 stress 0.2132344 
## Run 318 stress 0.2097478 
## ... Procrustes: rmse 0.003442987  max resid 0.02886923 
## Run 319 stress 0.2134936 
## Run 320 stress 0.2133612 
## Run 321 stress 0.2101938 
## Run 322 stress 0.2097201 
## ... Procrustes: rmse 0.004828095  max resid 0.03427877 
## Run 323 stress 0.2096708 
## ... Procrustes: rmse 0.004766372  max resid 0.04152913 
## Run 324 stress 0.2104983 
## Run 325 stress 0.2180135 
## Run 326 stress 0.2151474 
## Run 327 stress 0.2149667 
## Run 328 stress 0.2233816 
## Run 329 stress 0.2102462 
## Run 330 stress 0.2102764 
## Run 331 stress 0.2166487 
## Run 332 stress 0.2097506 
## ... Procrustes: rmse 0.0111082  max resid 0.09923051 
## Run 333 stress 0.2100734 
## ... Procrustes: rmse 0.01114633  max resid 0.1260974 
## Run 334 stress 0.2098872 
## ... Procrustes: rmse 0.01418014  max resid 0.1408277 
## Run 335 stress 0.2116357 
## Run 336 stress 0.2140667 
## Run 337 stress 0.2097803 
## ... Procrustes: rmse 0.004390465  max resid 0.03171923 
## Run 338 stress 0.2134122 
## Run 339 stress 0.2116539 
## Run 340 stress 0.2098687 
## ... Procrustes: rmse 0.01298013  max resid 0.1138732 
## Run 341 stress 0.2203287 
## Run 342 stress 0.2097619 
## ... Procrustes: rmse 0.009302973  max resid 0.09775453 
## Run 343 stress 0.2096847 
## ... Procrustes: rmse 0.01063181  max resid 0.09906337 
## Run 344 stress 0.2147676 
## Run 345 stress 0.226731 
## Run 346 stress 0.216564 
## Run 347 stress 0.2096761 
## ... Procrustes: rmse 0.005010664  max resid 0.04394692 
## Run 348 stress 0.2121353 
## Run 349 stress 0.2112752 
## Run 350 stress 0.2125621 
## Run 351 stress 0.212163 
## Run 352 stress 0.2098232 
## ... Procrustes: rmse 0.01122232  max resid 0.1118926 
## Run 353 stress 0.2146635 
## Run 354 stress 0.2217151 
## Run 355 stress 0.2098845 
## ... Procrustes: rmse 0.01252086  max resid 0.1167795 
## Run 356 stress 0.2150899 
## Run 357 stress 0.211638 
## Run 358 stress 0.2130409 
## Run 359 stress 0.2134104 
## Run 360 stress 0.2101554 
## ... Procrustes: rmse 0.01083261  max resid 0.09878528 
## Run 361 stress 0.2097181 
## ... Procrustes: rmse 0.01049077  max resid 0.0990249 
## Run 362 stress 0.2098301 
## ... Procrustes: rmse 0.00926097  max resid 0.1120316 
## Run 363 stress 0.2102157 
## Run 364 stress 0.2140452 
## Run 365 stress 0.2169991 
## Run 366 stress 0.212611 
## Run 367 stress 0.2133488 
## Run 368 stress 0.2199419 
## Run 369 stress 0.2102365 
## Run 370 stress 0.2137365 
## Run 371 stress 0.2099406 
## ... Procrustes: rmse 0.01047812  max resid 0.1129201 
## Run 372 stress 0.2102105 
## Run 373 stress 0.2146606 
## Run 374 stress 0.2098363 
## ... Procrustes: rmse 0.01002951  max resid 0.1128423 
## Run 375 stress 0.2102972 
## Run 376 stress 0.212566 
## Run 377 stress 0.2168887 
## Run 378 stress 0.227929 
## Run 379 stress 0.2165098 
## Run 380 stress 0.2174999 
## Run 381 stress 0.2105593 
## Run 382 stress 0.2199012 
## Run 383 stress 0.2144811 
## Run 384 stress 0.2101337 
## ... Procrustes: rmse 0.01049979  max resid 0.09812873 
## Run 385 stress 0.2132895 
## Run 386 stress 0.2098337 
## ... Procrustes: rmse 0.01222055  max resid 0.1103748 
## Run 387 stress 0.213875 
## Run 388 stress 0.2122398 
## Run 389 stress 0.2098329 
## ... Procrustes: rmse 0.01309892  max resid 0.1247961 
## Run 390 stress 0.2129427 
## Run 391 stress 0.210164 
## Run 392 stress 0.2102065 
## Run 393 stress 0.2101834 
## Run 394 stress 0.209848 
## ... Procrustes: rmse 0.01024273  max resid 0.1126391 
## Run 395 stress 0.2096781 
## ... Procrustes: rmse 0.01004504  max resid 0.09877602 
## Run 396 stress 0.210343 
## Run 397 stress 0.210212 
## Run 398 stress 0.2191958 
## Run 399 stress 0.2133137 
## Run 400 stress 0.2098878 
## ... Procrustes: rmse 0.0139741  max resid 0.1332329 
## Run 401 stress 0.2119699 
## Run 402 stress 0.2101601 
## Run 403 stress 0.2098225 
## ... Procrustes: rmse 0.01051924  max resid 0.1058439 
## Run 404 stress 0.2165482 
## Run 405 stress 0.2102731 
## Run 406 stress 0.2101015 
## ... Procrustes: rmse 0.00583097  max resid 0.07021153 
## Run 407 stress 0.2098087 
## ... Procrustes: rmse 0.01306992  max resid 0.1220176 
## Run 408 stress 0.2148146 
## Run 409 stress 0.2096876 
## ... Procrustes: rmse 0.01058089  max resid 0.09911439 
## Run 410 stress 0.2097892 
## ... Procrustes: rmse 0.007490779  max resid 0.09318147 
## Run 411 stress 0.2130292 
## Run 412 stress 0.2134101 
## Run 413 stress 0.2098369 
## ... Procrustes: rmse 0.009991527  max resid 0.113452 
## Run 414 stress 0.2136995 
## Run 415 stress 0.2096845 
## ... Procrustes: rmse 0.002924546  max resid 0.01906487 
## Run 416 stress 0.2098833 
## ... Procrustes: rmse 0.01388903  max resid 0.1358856 
## Run 417 stress 0.2101281 
## ... Procrustes: rmse 0.01083026  max resid 0.09828001 
## Run 418 stress 0.2151252 
## Run 419 stress 0.2117031 
## Run 420 stress 0.2107329 
## Run 421 stress 0.2098218 
## ... Procrustes: rmse 0.01301204  max resid 0.109759 
## Run 422 stress 0.2129751 
## Run 423 stress 0.2148817 
## Run 424 stress 0.209928 
## ... Procrustes: rmse 0.009877868  max resid 0.1130072 
## Run 425 stress 0.2101561 
## ... Procrustes: rmse 0.01133897  max resid 0.09872614 
## Run 426 stress 0.2098262 
## ... Procrustes: rmse 0.008287014  max resid 0.1003464 
## Run 427 stress 0.2102782 
## Run 428 stress 0.2133092 
## Run 429 stress 0.210292 
## Run 430 stress 0.2124555 
## Run 431 stress 0.2206813 
## Run 432 stress 0.2102762 
## Run 433 stress 0.2103125 
## Run 434 stress 0.2128136 
## Run 435 stress 0.2102859 
## Run 436 stress 0.2132208 
## Run 437 stress 0.2258949 
## Run 438 stress 0.2097383 
## ... Procrustes: rmse 0.01111984  max resid 0.09858806 
## Run 439 stress 0.2098313 
## ... Procrustes: rmse 0.01090536  max resid 0.110615 
## Run 440 stress 0.2097245 
## ... Procrustes: rmse 0.00896737  max resid 0.09506139 
## Run 441 stress 0.2098812 
## ... Procrustes: rmse 0.01166169  max resid 0.1139626 
## Run 442 stress 0.2098729 
## ... Procrustes: rmse 0.01354766  max resid 0.1250313 
## Run 443 stress 0.2102068 
## Run 444 stress 0.2101546 
## ... Procrustes: rmse 0.01112335  max resid 0.1134751 
## Run 445 stress 0.2102841 
## Run 446 stress 0.2176842 
## Run 447 stress 0.209817 
## ... Procrustes: rmse 0.008712973  max resid 0.1126624 
## Run 448 stress 0.2116481 
## Run 449 stress 0.2125367 
## Run 450 stress 0.2143741 
## Run 451 stress 0.211241 
## Run 452 stress 0.2180871 
## Run 453 stress 0.2181374 
## Run 454 stress 0.2116885 
## Run 455 stress 0.2131732 
## Run 456 stress 0.2124737 
## Run 457 stress 0.2124675 
## Run 458 stress 0.2162412 
## Run 459 stress 0.2116937 
## Run 460 stress 0.2117203 
## Run 461 stress 0.2140095 
## Run 462 stress 0.2134298 
## Run 463 stress 0.209756 
## ... Procrustes: rmse 0.007554595  max resid 0.0543215 
## Run 464 stress 0.2097526 
## ... Procrustes: rmse 0.009113227  max resid 0.11116 
## Run 465 stress 0.2098637 
## ... Procrustes: rmse 0.01220602  max resid 0.1145546 
## Run 466 stress 0.2148739 
## Run 467 stress 0.2103035 
## Run 468 stress 0.2150249 
## Run 469 stress 0.210376 
## Run 470 stress 0.2097718 
## ... Procrustes: rmse 0.009995158  max resid 0.09534522 
## Run 471 stress 0.2165525 
## Run 472 stress 0.2098371 
## ... Procrustes: rmse 0.01169932  max resid 0.1229044 
## Run 473 stress 0.2100662 
## ... Procrustes: rmse 0.00567013  max resid 0.07089248 
## Run 474 stress 0.2124827 
## Run 475 stress 0.213092 
## Run 476 stress 0.2134259 
## Run 477 stress 0.2098231 
## ... Procrustes: rmse 0.0102838  max resid 0.09278108 
## Run 478 stress 0.2150128 
## Run 479 stress 0.2101433 
## ... Procrustes: rmse 0.01056589  max resid 0.09868389 
## Run 480 stress 0.2132608 
## Run 481 stress 0.2102201 
## Run 482 stress 0.2102669 
## Run 483 stress 0.2116403 
## Run 484 stress 0.2125891 
## Run 485 stress 0.2126845 
## Run 486 stress 0.2102716 
## Run 487 stress 0.2101272 
## ... Procrustes: rmse 0.01496649  max resid 0.1384985 
## Run 488 stress 0.2098831 
## ... Procrustes: rmse 0.01392064  max resid 0.1319699 
## Run 489 stress 0.2129511 
## Run 490 stress 0.2097241 
## ... Procrustes: rmse 0.009260796  max resid 0.09515417 
## Run 491 stress 0.213321 
## Run 492 stress 0.2116403 
## Run 493 stress 0.2126446 
## Run 494 stress 0.2098293 
## ... Procrustes: rmse 0.009713215  max resid 0.1127126 
## Run 495 stress 0.2099027 
## ... Procrustes: rmse 0.01258209  max resid 0.1179552 
## Run 496 stress 0.2100552 
## ... Procrustes: rmse 0.006667917  max resid 0.07186998 
## Run 497 stress 0.2218464 
## Run 498 stress 0.2101983 
## Run 499 stress 0.2097185 
## ... Procrustes: rmse 0.007238261  max resid 0.05666298 
## Run 500 stress 0.2133971 
## Run 501 stress 0.2126056 
## Run 502 stress 0.2097925 
## ... Procrustes: rmse 0.01232861  max resid 0.11741 
## Run 503 stress 0.2121105 
## Run 504 stress 0.2116678 
## Run 505 stress 0.2146526 
## Run 506 stress 0.2098209 
## ... Procrustes: rmse 0.01348859  max resid 0.1280534 
## Run 507 stress 0.2124922 
## Run 508 stress 0.2131854 
## Run 509 stress 0.2246319 
## Run 510 stress 0.2102596 
## Run 511 stress 0.2129889 
## Run 512 stress 0.2096878 
## ... Procrustes: rmse 0.004433113  max resid 0.03929464 
## Run 513 stress 0.2097068 
## ... Procrustes: rmse 0.009824754  max resid 0.09575024 
## Run 514 stress 0.2098107 
## ... Procrustes: rmse 0.009370394  max resid 0.1134902 
## Run 515 stress 0.2130006 
## Run 516 stress 0.2098781 
## ... Procrustes: rmse 0.01268227  max resid 0.1138048 
## Run 517 stress 0.2238388 
## Run 518 stress 0.2098942 
## ... Procrustes: rmse 0.01405057  max resid 0.1377006 
## Run 519 stress 0.2097199 
## ... Procrustes: rmse 0.00995791  max resid 0.09832648 
## Run 520 stress 0.2160599 
## Run 521 stress 0.2131696 
## Run 522 stress 0.2103036 
## Run 523 stress 0.2101236 
## ... Procrustes: rmse 0.008375699  max resid 0.06955491 
## Run 524 stress 0.2209888 
## Run 525 stress 0.2098637 
## ... Procrustes: rmse 0.01322165  max resid 0.1228979 
## Run 526 stress 0.2097383 
## ... Procrustes: rmse 0.0112135  max resid 0.09913862 
## Run 527 stress 0.221518 
## Run 528 stress 0.2133119 
## Run 529 stress 0.2097641 
## ... Procrustes: rmse 0.00328669  max resid 0.02486074 
## Run 530 stress 0.209751 
## ... Procrustes: rmse 0.00744657  max resid 0.0565538 
## Run 531 stress 0.2129932 
## Run 532 stress 0.2097561 
## ... Procrustes: rmse 0.009516546  max resid 0.09536615 
## Run 533 stress 0.2127016 
## Run 534 stress 0.2101555 
## ... Procrustes: rmse 0.009425246  max resid 0.09380946 
## Run 535 stress 0.2099311 
## ... Procrustes: rmse 0.01211857  max resid 0.1150887 
## Run 536 stress 0.2129333 
## Run 537 stress 0.2098996 
## ... Procrustes: rmse 0.01388681  max resid 0.1390573 
## Run 538 stress 0.2102743 
## Run 539 stress 0.2102852 
## Run 540 stress 0.2103003 
## Run 541 stress 0.2126814 
## Run 542 stress 0.2126705 
## Run 543 stress 0.2133913 
## Run 544 stress 0.2129759 
## Run 545 stress 0.2129549 
## Run 546 stress 0.2113105 
## Run 547 stress 0.2138326 
## Run 548 stress 0.2103062 
## Run 549 stress 0.2102717 
## Run 550 stress 0.2097626 
## ... Procrustes: rmse 0.0131386  max resid 0.1128522 
## Run 551 stress 0.2098996 
## ... Procrustes: rmse 0.01354929  max resid 0.12633 
## Run 552 stress 0.2134827 
## Run 553 stress 0.2102233 
## Run 554 stress 0.2133619 
## Run 555 stress 0.21307 
## Run 556 stress 0.2126846 
## Run 557 stress 0.2098711 
## ... Procrustes: rmse 0.01335873  max resid 0.1194084 
## Run 558 stress 0.2145913 
## Run 559 stress 0.2174576 
## Run 560 stress 0.2101396 
## ... Procrustes: rmse 0.007067692  max resid 0.07386116 
## Run 561 stress 0.2132788 
## Run 562 stress 0.2171958 
## Run 563 stress 0.2098602 
## ... Procrustes: rmse 0.009652608  max resid 0.1121361 
## Run 564 stress 0.2128995 
## Run 565 stress 0.2121708 
## Run 566 stress 0.2143163 
## Run 567 stress 0.2098213 
## ... Procrustes: rmse 0.0130101  max resid 0.1160059 
## Run 568 stress 0.2147048 
## Run 569 stress 0.2131567 
## Run 570 stress 0.2116479 
## Run 571 stress 0.211741 
## Run 572 stress 0.2103108 
## Run 573 stress 0.2133283 
## Run 574 stress 0.2129506 
## Run 575 stress 0.209682 
## ... Procrustes: rmse 0.01023864  max resid 0.09875852 
## Run 576 stress 0.2097514 
## ... Procrustes: rmse 0.00739025  max resid 0.05302408 
## Run 577 stress 0.2125916 
## Run 578 stress 0.2098354 
## ... Procrustes: rmse 0.01224141  max resid 0.1049909 
## Run 579 stress 0.2102654 
## Run 580 stress 0.213458 
## Run 581 stress 0.2101299 
## ... Procrustes: rmse 0.006798774  max resid 0.07396568 
## Run 582 stress 0.2097626 
## ... Procrustes: rmse 0.008905729  max resid 0.1144188 
## Run 583 stress 0.2141021 
## Run 584 stress 0.2130819 
## Run 585 stress 0.2203195 
## Run 586 stress 0.2176294 
## Run 587 stress 0.2133886 
## Run 588 stress 0.2098243 
## ... Procrustes: rmse 0.01248189  max resid 0.117224 
## Run 589 stress 0.2098762 
## ... Procrustes: rmse 0.01376392  max resid 0.1320373 
## Run 590 stress 0.212628 
## Run 591 stress 0.2170228 
## Run 592 stress 0.2097563 
## ... Procrustes: rmse 0.009861282  max resid 0.1236078 
## Run 593 stress 0.210225 
## Run 594 stress 0.2192589 
## Run 595 stress 0.2138189 
## Run 596 stress 0.2203743 
## Run 597 stress 0.2134586 
## Run 598 stress 0.2098216 
## ... Procrustes: rmse 0.01123969  max resid 0.1120439 
## Run 599 stress 0.2105365 
## Run 600 stress 0.2097506 
## ... Procrustes: rmse 0.009449495  max resid 0.09823792 
## Run 601 stress 0.2130849 
## Run 602 stress 0.2098006 
## ... Procrustes: rmse 0.009398278  max resid 0.1094274 
## Run 603 stress 0.212469 
## Run 604 stress 0.2187382 
## Run 605 stress 0.2101058 
## ... Procrustes: rmse 0.006508794  max resid 0.07351697 
## Run 606 stress 0.2117706 
## Run 607 stress 0.2098805 
## ... Procrustes: rmse 0.0121071  max resid 0.1138486 
## Run 608 stress 0.2102228 
## Run 609 stress 0.212214 
## Run 610 stress 0.2097664 
## ... Procrustes: rmse 0.003966494  max resid 0.03796427 
## Run 611 stress 0.2098712 
## ... Procrustes: rmse 0.01287611  max resid 0.1212562 
## Run 612 stress 0.2129962 
## Run 613 stress 0.2126015 
## Run 614 stress 0.2098903 
## ... Procrustes: rmse 0.01365958  max resid 0.1374179 
## Run 615 stress 0.2112601 
## Run 616 stress 0.2117748 
## Run 617 stress 0.224573 
## Run 618 stress 0.2097011 
## ... Procrustes: rmse 0.003948496  max resid 0.0316665 
## Run 619 stress 0.2103024 
## Run 620 stress 0.2098829 
## ... Procrustes: rmse 0.01343991  max resid 0.1326256 
## Run 621 stress 0.2136695 
## Run 622 stress 0.2102351 
## Run 623 stress 0.2116491 
## Run 624 stress 0.2101367 
## ... Procrustes: rmse 0.0105621  max resid 0.09871279 
## Run 625 stress 0.2146845 
## Run 626 stress 0.2103098 
## Run 627 stress 0.215058 
## Run 628 stress 0.2179606 
## Run 629 stress 0.2117323 
## Run 630 stress 0.2131183 
## Run 631 stress 0.213109 
## Run 632 stress 0.2122041 
## Run 633 stress 0.2112698 
## Run 634 stress 0.2098719 
## ... Procrustes: rmse 0.01266707  max resid 0.1143693 
## Run 635 stress 0.212768 
## Run 636 stress 0.2097512 
## ... Procrustes: rmse 0.007239067  max resid 0.05582716 
## Run 637 stress 0.2134185 
## Run 638 stress 0.2174308 
## Run 639 stress 0.2097613 
## ... Procrustes: rmse 0.009878386  max resid 0.09558517 
## Run 640 stress 0.2202627 
## Run 641 stress 0.2129791 
## Run 642 stress 0.2102823 
## Run 643 stress 0.2143019 
## Run 644 stress 0.2165591 
## Run 645 stress 0.2133393 
## Run 646 stress 0.2184693 
## Run 647 stress 0.2122183 
## Run 648 stress 0.2129751 
## Run 649 stress 0.2191552 
## Run 650 stress 0.2128711 
## Run 651 stress 0.2102778 
## Run 652 stress 0.2148477 
## Run 653 stress 0.21674 
## Run 654 stress 0.2146636 
## Run 655 stress 0.2133478 
## Run 656 stress 0.2168372 
## Run 657 stress 0.216567 
## Run 658 stress 0.2163675 
## Run 659 stress 0.2096758 
## ... Procrustes: rmse 0.004386687  max resid 0.03875669 
## Run 660 stress 0.2125953 
## Run 661 stress 0.2101222 
## ... Procrustes: rmse 0.01093279  max resid 0.09887241 
## Run 662 stress 0.2137068 
## Run 663 stress 0.209788 
## ... Procrustes: rmse 0.01307202  max resid 0.1106987 
## Run 664 stress 0.2101932 
## Run 665 stress 0.2115749 
## Run 666 stress 0.2118875 
## Run 667 stress 0.2133668 
## Run 668 stress 0.2112687 
## Run 669 stress 0.2129575 
## Run 670 stress 0.2102639 
## Run 671 stress 0.2096726 
## ... Procrustes: rmse 0.005199624  max resid 0.04626864 
## Run 672 stress 0.2262828 
## Run 673 stress 0.2116411 
## Run 674 stress 0.2132183 
## Run 675 stress 0.2102158 
## Run 676 stress 0.2101818 
## Run 677 stress 0.2125013 
## Run 678 stress 0.209726 
## ... Procrustes: rmse 0.005668511  max resid 0.04343082 
## Run 679 stress 0.2102905 
## Run 680 stress 0.2117593 
## Run 681 stress 0.2097953 
## ... Procrustes: rmse 0.01091975  max resid 0.1013251 
## Run 682 stress 0.2180916 
## Run 683 stress 0.2122097 
## Run 684 stress 0.2098177 
## ... Procrustes: rmse 0.01036717  max resid 0.09324884 
## Run 685 stress 0.2101629 
## Run 686 stress 0.2098527 
## ... Procrustes: rmse 0.00861048  max resid 0.1125584 
## Run 687 stress 0.2148762 
## Run 688 stress 0.2146983 
## Run 689 stress 0.2099187 
## ... Procrustes: rmse 0.01353557  max resid 0.1315924 
## Run 690 stress 0.2098406 
## ... Procrustes: rmse 0.01370917  max resid 0.1308513 
## Run 691 stress 0.2099621 
## ... Procrustes: rmse 0.01314241  max resid 0.1197407 
## Run 692 stress 0.2124713 
## Run 693 stress 0.2098684 
## ... Procrustes: rmse 0.01307463  max resid 0.1269314 
## Run 694 stress 0.213849 
## Run 695 stress 0.2112407 
## Run 696 stress 0.2133916 
## Run 697 stress 0.2102695 
## Run 698 stress 0.2102788 
## Run 699 stress 0.2224951 
## Run 700 stress 0.2096754 
## ... Procrustes: rmse 0.001064338  max resid 0.01039364 
## Run 701 stress 0.2097332 
## ... Procrustes: rmse 0.003137598  max resid 0.02738151 
## Run 702 stress 0.2157909 
## Run 703 stress 0.2125736 
## Run 704 stress 0.2129893 
## Run 705 stress 0.2098479 
## ... Procrustes: rmse 0.01019898  max resid 0.1125492 
## Run 706 stress 0.2132019 
## Run 707 stress 0.2129139 
## Run 708 stress 0.2115072 
## Run 709 stress 0.2177483 
## Run 710 stress 0.2131668 
## Run 711 stress 0.2125986 
## Run 712 stress 0.2120276 
## Run 713 stress 0.2172744 
## Run 714 stress 0.2098545 
## ... Procrustes: rmse 0.01012026  max resid 0.1125063 
## Run 715 stress 0.2097645 
## ... Procrustes: rmse 0.01228445  max resid 0.1057485 
## Run 716 stress 0.2163647 
## Run 717 stress 0.2097315 
## ... Procrustes: rmse 0.004638391  max resid 0.02975934 
## Run 718 stress 0.2102133 
## Run 719 stress 0.2102299 
## Run 720 stress 0.2101822 
## Run 721 stress 0.2101891 
## Run 722 stress 0.2147016 
## Run 723 stress 0.2101189 
## ... Procrustes: rmse 0.007964828  max resid 0.06936149 
## Run 724 stress 0.2175506 
## Run 725 stress 0.2098643 
## ... Procrustes: rmse 0.01326766  max resid 0.1236441 
## Run 726 stress 0.2179765 
## Run 727 stress 0.2121183 
## Run 728 stress 0.2098688 
## ... Procrustes: rmse 0.01272242  max resid 0.1210226 
## Run 729 stress 0.2129596 
## Run 730 stress 0.2097576 
## ... Procrustes: rmse 0.01000468  max resid 0.1192852 
## Run 731 stress 0.2129137 
## Run 732 stress 0.2133866 
## Run 733 stress 0.2103247 
## Run 734 stress 0.2136471 
## Run 735 stress 0.2135083 
## Run 736 stress 0.2098744 
## ... Procrustes: rmse 0.01367328  max resid 0.1304632 
## Run 737 stress 0.2123359 
## Run 738 stress 0.209876 
## ... Procrustes: rmse 0.0135356  max resid 0.1222613 
## Run 739 stress 0.2125567 
## Run 740 stress 0.2125471 
## Run 741 stress 0.2101942 
## Run 742 stress 0.2097434 
## ... Procrustes: rmse 0.007620573  max resid 0.05657957 
## Run 743 stress 0.2130308 
## Run 744 stress 0.2101334 
## ... Procrustes: rmse 0.01097001  max resid 0.09814399 
## Run 745 stress 0.2133995 
## Run 746 stress 0.2160963 
## Run 747 stress 0.2132863 
## Run 748 stress 0.209972 
## ... Procrustes: rmse 0.01356242  max resid 0.1287512 
## Run 749 stress 0.2101236 
## ... Procrustes: rmse 0.007954414  max resid 0.06943498 
## Run 750 stress 0.2098779 
## ... Procrustes: rmse 0.01334148  max resid 0.1268681 
## Run 751 stress 0.2102644 
## Run 752 stress 0.2147929 
## Run 753 stress 0.2101707 
## Run 754 stress 0.2096807 
## ... Procrustes: rmse 0.004103403  max resid 0.03588827 
## Run 755 stress 0.213447 
## Run 756 stress 0.2113295 
## Run 757 stress 0.2124826 
## Run 758 stress 0.2176852 
## Run 759 stress 0.213415 
## Run 760 stress 0.2122851 
## Run 761 stress 0.2212595 
## Run 762 stress 0.2096978 
## ... Procrustes: rmse 0.009229628  max resid 0.0953311 
## Run 763 stress 0.2136889 
## Run 764 stress 0.2226695 
## Run 765 stress 0.2299467 
## Run 766 stress 0.2128666 
## Run 767 stress 0.2160498 
## Run 768 stress 0.2195187 
## Run 769 stress 0.2096948 
## ... Procrustes: rmse 0.005953409  max resid 0.05176567 
## Run 770 stress 0.2146362 
## Run 771 stress 0.2097326 
## ... Procrustes: rmse 0.01106645  max resid 0.09903854 
## Run 772 stress 0.2166668 
## Run 773 stress 0.2147922 
## Run 774 stress 0.2128825 
## Run 775 stress 0.2099357 
## ... Procrustes: rmse 0.01125035  max resid 0.1148871 
## Run 776 stress 0.2097934 
## ... Procrustes: rmse 0.012659  max resid 0.1040199 
## Run 777 stress 0.2112719 
## Run 778 stress 0.2130767 
## Run 779 stress 0.2102953 
## Run 780 stress 0.2114606 
## Run 781 stress 0.2098755 
## ... Procrustes: rmse 0.01296009  max resid 0.1138902 
## Run 782 stress 0.2097301 
## ... Procrustes: rmse 0.005984004  max resid 0.05298279 
## Run 783 stress 0.2097357 
## ... Procrustes: rmse 0.01083969  max resid 0.09930591 
## Run 784 stress 0.2098297 
## ... Procrustes: rmse 0.01080947  max resid 0.1078383 
## Run 785 stress 0.2098907 
## ... Procrustes: rmse 0.01233384  max resid 0.114803 
## Run 786 stress 0.2131558 
## Run 787 stress 0.2097781 
## ... Procrustes: rmse 0.01188473  max resid 0.102094 
## Run 788 stress 0.2164021 
## Run 789 stress 0.2098214 
## ... Procrustes: rmse 0.01022317  max resid 0.1083471 
## Run 790 stress 0.2098736 
## ... Procrustes: rmse 0.01355002  max resid 0.1234737 
## Run 791 stress 0.2102802 
## Run 792 stress 0.2123186 
## Run 793 stress 0.2161973 
## Run 794 stress 0.2098166 
## ... Procrustes: rmse 0.01335928  max resid 0.1254515 
## Run 795 stress 0.2144305 
## Run 796 stress 0.2126993 
## Run 797 stress 0.2098219 
## ... Procrustes: rmse 0.01004642  max resid 0.1125127 
## Run 798 stress 0.2208317 
## Run 799 stress 0.2097876 
## ... Procrustes: rmse 0.01201141  max resid 0.1106461 
## Run 800 stress 0.2134448 
## Run 801 stress 0.2102826 
## Run 802 stress 0.2132248 
## Run 803 stress 0.2173746 
## Run 804 stress 0.2144933 
## Run 805 stress 0.2230081 
## Run 806 stress 0.2126217 
## Run 807 stress 0.2176444 
## Run 808 stress 0.2271627 
## Run 809 stress 0.2102893 
## Run 810 stress 0.2098678 
## ... Procrustes: rmse 0.01294458  max resid 0.1155142 
## Run 811 stress 0.2097821 
## ... Procrustes: rmse 0.01385073  max resid 0.1230284 
## Run 812 stress 0.216071 
## Run 813 stress 0.2236648 
## Run 814 stress 0.2140888 
## Run 815 stress 0.2097933 
## ... Procrustes: rmse 0.01216414  max resid 0.1040005 
## Run 816 stress 0.2184702 
## Run 817 stress 0.2098343 
## ... Procrustes: rmse 0.01336807  max resid 0.1255584 
## Run 818 stress 0.2098744 
## ... Procrustes: rmse 0.01347646  max resid 0.1281541 
## Run 819 stress 0.2129783 
## Run 820 stress 0.2123422 
## Run 821 stress 0.2097871 
## ... Procrustes: rmse 0.01243963  max resid 0.1156342 
## Run 822 stress 0.2097893 
## ... Procrustes: rmse 0.01215267  max resid 0.1125725 
## Run 823 stress 0.2117471 
## Run 824 stress 0.2097047 
## ... Procrustes: rmse 0.006414172  max resid 0.05232136 
## Run 825 stress 0.2101821 
## Run 826 stress 0.2138174 
## Run 827 stress 0.2100938 
## ... Procrustes: rmse 0.01144888  max resid 0.1141101 
## Run 828 stress 0.2097529 
## ... Procrustes: rmse 0.009653697  max resid 0.09563189 
## Run 829 stress 0.2096639 
## ... Procrustes: rmse 0.001667789  max resid 0.0131327 
## Run 830 stress 0.2099331 
## ... Procrustes: rmse 0.009404259  max resid 0.1133689 
## Run 831 stress 0.2180702 
## Run 832 stress 0.2242779 
## Run 833 stress 0.2096629 
## ... Procrustes: rmse 0.00210631  max resid 0.01522735 
## Run 834 stress 0.2222526 
## Run 835 stress 0.2102597 
## Run 836 stress 0.2158543 
## Run 837 stress 0.2098646 
## ... Procrustes: rmse 0.01182586  max resid 0.1146054 
## Run 838 stress 0.2098088 
## ... Procrustes: rmse 0.01386649  max resid 0.1153057 
## Run 839 stress 0.2098256 
## ... Procrustes: rmse 0.009527889  max resid 0.1121889 
## Run 840 stress 0.2098165 
## ... Procrustes: rmse 0.01091257  max resid 0.1132212 
## Run 841 stress 0.2137009 
## Run 842 stress 0.2127002 
## Run 843 stress 0.2097136 
## ... Procrustes: rmse 0.006723851  max resid 0.05528988 
## Run 844 stress 0.2308826 
## Run 845 stress 0.2199156 
## Run 846 stress 0.209756 
## ... Procrustes: rmse 0.01009308  max resid 0.09849361 
## Run 847 stress 0.2129637 
## Run 848 stress 0.2112354 
## Run 849 stress 0.2163042 
## Run 850 stress 0.2201199 
## Run 851 stress 0.2101092 
## ... Procrustes: rmse 0.006682506  max resid 0.07357681 
## Run 852 stress 0.2102935 
## Run 853 stress 0.2118575 
## Run 854 stress 0.2101759 
## Run 855 stress 0.2136656 
## Run 856 stress 0.2254043 
## Run 857 stress 0.2097498 
## ... Procrustes: rmse 0.008828452  max resid 0.1080643 
## Run 858 stress 0.2180322 
## Run 859 stress 0.215366 
## Run 860 stress 0.209882 
## ... Procrustes: rmse 0.01385542  max resid 0.1330181 
## Run 861 stress 0.2129379 
## Run 862 stress 0.2098826 
## ... Procrustes: rmse 0.01384001  max resid 0.130788 
## Run 863 stress 0.2131054 
## Run 864 stress 0.2097754 
## ... Procrustes: rmse 0.01212088  max resid 0.1119183 
## Run 865 stress 0.2133504 
## Run 866 stress 0.2133863 
## Run 867 stress 0.2098874 
## ... Procrustes: rmse 0.01409695  max resid 0.137601 
## Run 868 stress 0.2121934 
## Run 869 stress 0.2097386 
## ... Procrustes: rmse 0.008153115  max resid 0.09374947 
## Run 870 stress 0.210266 
## Run 871 stress 0.2097684 
## ... Procrustes: rmse 0.01333438  max resid 0.1182951 
## Run 872 stress 0.2102723 
## Run 873 stress 0.2098276 
## ... Procrustes: rmse 0.01322426  max resid 0.1283852 
## Run 874 stress 0.2102053 
## Run 875 stress 0.2129794 
## Run 876 stress 0.2097542 
## ... Procrustes: rmse 0.01104338  max resid 0.0986199 
## Run 877 stress 0.2134099 
## Run 878 stress 0.2129573 
## Run 879 stress 0.2129824 
## Run 880 stress 0.2098298 
## ... Procrustes: rmse 0.01263921  max resid 0.1179243 
## Run 881 stress 0.2102495 
## Run 882 stress 0.2101509 
## ... Procrustes: rmse 0.01067218  max resid 0.09828677 
## Run 883 stress 0.2097982 
## ... Procrustes: rmse 0.01270636  max resid 0.1130211 
## Run 884 stress 0.2098408 
## ... Procrustes: rmse 0.01372478  max resid 0.1271599 
## Run 885 stress 0.2199901 
## Run 886 stress 0.2098343 
## ... Procrustes: rmse 0.01026003  max resid 0.1125524 
## Run 887 stress 0.2097135 
## ... Procrustes: rmse 0.0065404  max resid 0.05041735 
## Run 888 stress 0.220841 
## Run 889 stress 0.2121718 
## Run 890 stress 0.2145736 
## Run 891 stress 0.2102713 
## Run 892 stress 0.2131175 
## Run 893 stress 0.209814 
## ... Procrustes: rmse 0.009840559  max resid 0.1128721 
## Run 894 stress 0.2096696 
## ... Procrustes: rmse 0.004444276  max resid 0.04196895 
## Run 895 stress 0.212127 
## Run 896 stress 0.2116384 
## Run 897 stress 0.212472 
## Run 898 stress 0.2098858 
## ... Procrustes: rmse 0.01415194  max resid 0.1384793 
## Run 899 stress 0.2126071 
## Run 900 stress 0.21289 
## Run 901 stress 0.2120337 
## Run 902 stress 0.2097171 
## ... Procrustes: rmse 0.009536104  max resid 0.09542711 
## Run 903 stress 0.2125786 
## Run 904 stress 0.2129556 
## Run 905 stress 0.2116836 
## Run 906 stress 0.2133044 
## Run 907 stress 0.2096878 
## ... Procrustes: rmse 0.009311335  max resid 0.09817816 
## Run 908 stress 0.2124906 
## Run 909 stress 0.2128701 
## Run 910 stress 0.2132509 
## Run 911 stress 0.2098739 
## ... Procrustes: rmse 0.0137181  max resid 0.1325362 
## Run 912 stress 0.210116 
## ... Procrustes: rmse 0.006449523  max resid 0.07322291 
## Run 913 stress 0.2129641 
## Run 914 stress 0.2101999 
## Run 915 stress 0.2112876 
## Run 916 stress 0.216283 
## Run 917 stress 0.2131026 
## Run 918 stress 0.2097183 
## ... Procrustes: rmse 0.01040086  max resid 0.09885583 
## Run 919 stress 0.2230509 
## Run 920 stress 0.2134593 
## Run 921 stress 0.2101266 
## ... Procrustes: rmse 0.01091151  max resid 0.09855517 
## Run 922 stress 0.2098015 
## ... Procrustes: rmse 0.01190137  max resid 0.09826269 
## Run 923 stress 0.2242289 
## Run 924 stress 0.2202579 
## Run 925 stress 0.2128869 
## Run 926 stress 0.2103286 
## Run 927 stress 0.2126258 
## Run 928 stress 0.2173053 
## Run 929 stress 0.2098777 
## ... Procrustes: rmse 0.01184396  max resid 0.1144778 
## Run 930 stress 0.2116584 
## Run 931 stress 0.2243239 
## Run 932 stress 0.2098194 
## ... Procrustes: rmse 0.009328302  max resid 0.112201 
## Run 933 stress 0.2153703 
## Run 934 stress 0.209889 
## ... Procrustes: rmse 0.01414107  max resid 0.1362336 
## Run 935 stress 0.2153822 
## Run 936 stress 0.2096685 
## ... Procrustes: rmse 0.001726747  max resid 0.01456804 
## Run 937 stress 0.2129479 
## Run 938 stress 0.2097257 
## ... Procrustes: rmse 0.0105934  max resid 0.09918761 
## Run 939 stress 0.2113066 
## Run 940 stress 0.2134383 
## Run 941 stress 0.2132259 
## Run 942 stress 0.2127133 
## Run 943 stress 0.2097755 
## ... Procrustes: rmse 0.009776879  max resid 0.1139626 
## Run 944 stress 0.2096945 
## ... Procrustes: rmse 0.01040407  max resid 0.09904312 
## Run 945 stress 0.2129204 
## Run 946 stress 0.2242187 
## Run 947 stress 0.2134914 
## Run 948 stress 0.210116 
## ... Procrustes: rmse 0.006384516  max resid 0.07336787 
## Run 949 stress 0.2098328 
## ... Procrustes: rmse 0.01353015  max resid 0.120206 
## Run 950 stress 0.2147839 
## Run 951 stress 0.2137019 
## Run 952 stress 0.2124964 
## Run 953 stress 0.2096931 
## ... Procrustes: rmse 0.01072479  max resid 0.09878907 
## Run 954 stress 0.2209515 
## Run 955 stress 0.2216707 
## Run 956 stress 0.2098121 
## ... Procrustes: rmse 0.01007834  max resid 0.1174334 
## Run 957 stress 0.2098663 
## ... Procrustes: rmse 0.01338016  max resid 0.1253382 
## Run 958 stress 0.2132827 
## Run 959 stress 0.2103063 
## Run 960 stress 0.2099595 
## ... Procrustes: rmse 0.01248918  max resid 0.1135436 
## Run 961 stress 0.215346 
## Run 962 stress 0.2103209 
## Run 963 stress 0.2277915 
## Run 964 stress 0.2130794 
## Run 965 stress 0.2192446 
## Run 966 stress 0.209772 
## ... Procrustes: rmse 0.01350762  max resid 0.1197548 
## Run 967 stress 0.2176923 
## Run 968 stress 0.2128034 
## Run 969 stress 0.224562 
## Run 970 stress 0.2121562 
## Run 971 stress 0.2098111 
## ... Procrustes: rmse 0.009508489  max resid 0.1132301 
## Run 972 stress 0.2096771 
## ... Procrustes: rmse 0.01029215  max resid 0.09887659 
## Run 973 stress 0.2135696 
## Run 974 stress 0.2098916 
## ... Procrustes: rmse 0.01217843  max resid 0.1138886 
## Run 975 stress 0.2129745 
## Run 976 stress 0.2124869 
## Run 977 stress 0.21041 
## Run 978 stress 0.2098757 
## ... Procrustes: rmse 0.01365951  max resid 0.1253434 
## Run 979 stress 0.209715 
## ... Procrustes: rmse 0.008923703  max resid 0.09520818 
## Run 980 stress 0.2125045 
## Run 981 stress 0.2125826 
## Run 982 stress 0.2126617 
## Run 983 stress 0.2096769 
## ... Procrustes: rmse 0.002537145  max resid 0.01586817 
## Run 984 stress 0.2098214 
## ... Procrustes: rmse 0.009560405  max resid 0.111947 
## Run 985 stress 0.2121464 
## Run 986 stress 0.2128249 
## Run 987 stress 0.2198862 
## Run 988 stress 0.21167 
## Run 989 stress 0.2101536 
## ... Procrustes: rmse 0.01094475  max resid 0.1132663 
## Run 990 stress 0.2103213 
## Run 991 stress 0.2097708 
## ... Procrustes: rmse 0.01346718  max resid 0.1151883 
## Run 992 stress 0.2157162 
## Run 993 stress 0.2251516 
## Run 994 stress 0.2101384 
## ... Procrustes: rmse 0.01042577  max resid 0.09837933 
## Run 995 stress 0.2098753 
## ... Procrustes: rmse 0.01270207  max resid 0.1139496 
## Run 996 stress 0.2098751 
## ... Procrustes: rmse 0.01271014  max resid 0.1139581 
## Run 997 stress 0.2102304 
## Run 998 stress 0.214995 
## Run 999 stress 0.212579 
## Run 1000 stress 0.2098148 
## ... Procrustes: rmse 0.009875996  max resid 0.1130735 
## *** No convergence -- monoMDS stopping criteria:
##     55: no. of iterations >= maxit
##    945: stress ratio > sratmax
str(meta.nmds.FloristicSurvey2D)
## List of 35
##  $ nobj      : int 195
##  $ nfix      : int 0
##  $ ndim      : num 2
##  $ ndis      : int 18915
##  $ ngrp      : int 1
##  $ diss      : num [1:18915] 0 0 0 0 0 0 0 0 0 0 ...
##  $ iidx      : int [1:18915] 114 105 114 67 119 131 89 97 111 111 ...
##  $ jidx      : int [1:18915] 100 103 112 2 101 120 55 56 103 105 ...
##  $ xinit     : num [1:390] 0.923 0.826 0.269 0.991 0.27 ...
##  $ istart    : int 1
##  $ isform    : int 1
##  $ ities     : int 1
##  $ iregn     : int 1
##  $ iscal     : int 1
##  $ maxits    : int 200
##  $ sratmx    : num 1
##  $ strmin    : num 1e-04
##  $ sfgrmn    : num 1e-07
##  $ dist      : num [1:18915] 0 0 0 0 0 0 0 0 0 0 ...
##  $ dhat      : num [1:18915] 0 0 0 0 0 0 0 0 0 0 ...
##  $ points    : num [1:195, 1:2] -0.132 -0.147 -0.158 -0.105 -0.106 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:195] "7" "7" "7" "7" ...
##   .. ..$ : chr [1:2] "MDS1" "MDS2"
##   ..- attr(*, "centre")= logi TRUE
##   ..- attr(*, "pc")= logi TRUE
##   ..- attr(*, "halfchange")= logi FALSE
##   ..- attr(*, "internalscaling")= num 4.31
##  $ stress    : num 0.21
##  $ grstress  : num 0.21
##  $ iters     : int 81
##  $ icause    : int 3
##  $ call      : language metaMDS(comm = dist_FloristicSurvey, k = 2, trymax = 1000)
##  $ model     : chr "global"
##  $ distmethod: chr "binary bray"
##  $ distcall  : chr "vegdist(x = M, method = \"bray\", binary = T)"
##  $ distance  : chr "binary bray"
##  $ converged : logi FALSE
##  $ tries     : num 1000
##  $ engine    : chr "monoMDS"
##  $ species   : logi NA
##  $ data      : chr "dist_FloristicSurvey"
##  - attr(*, "class")= chr [1:2] "metaMDS" "monoMDS"
stressplot(meta.nmds.FloristicSurvey2D)

# Im getting a little above a stress of 0.2 (0.207), which isnt ideal, ill try it again with 3 dimension
# A good rule of thumb: stress < 0.05 provides an excellent representation in reduced dimensions, < 0.1 is great, < 0.2 is good/ok, and stress < 0.3 provides a poor representation.
meta.nmds.FloristicSurvey3D <- metaMDS(dist_FloristicSurvey, k=3, trymax = 1000)
## Run 0 stress 0.1472339 
## Run 1 stress 0.147845 
## Run 2 stress 0.1486126 
## Run 3 stress 0.1478375 
## Run 4 stress 0.1481742 
## Run 5 stress 0.1488738 
## Run 6 stress 0.1475808 
## ... Procrustes: rmse 0.01567161  max resid 0.09041528 
## Run 7 stress 0.1482255 
## Run 8 stress 0.1482442 
## Run 9 stress 0.1560041 
## Run 10 stress 0.1486371 
## Run 11 stress 0.1495387 
## Run 12 stress 0.1495404 
## Run 13 stress 0.1478405 
## Run 14 stress 0.1478471 
## Run 15 stress 0.1488738 
## Run 16 stress 0.1475676 
## ... Procrustes: rmse 0.01450191  max resid 0.0902353 
## Run 17 stress 0.1482355 
## Run 18 stress 0.1481492 
## Run 19 stress 0.1473331 
## ... Procrustes: rmse 0.006800388  max resid 0.08686157 
## Run 20 stress 0.1599306 
## Run 21 stress 0.1483659 
## Run 22 stress 0.1475892 
## ... Procrustes: rmse 0.01650029  max resid 0.1128641 
## Run 23 stress 0.1559226 
## Run 24 stress 0.1488719 
## Run 25 stress 0.1475837 
## ... Procrustes: rmse 0.01795506  max resid 0.1228054 
## Run 26 stress 0.1475107 
## ... Procrustes: rmse 0.0136737  max resid 0.09045298 
## Run 27 stress 0.1476433 
## ... Procrustes: rmse 0.01914247  max resid 0.1191426 
## Run 28 stress 0.1475539 
## ... Procrustes: rmse 0.01439849  max resid 0.08985557 
## Run 29 stress 0.1495296 
## Run 30 stress 0.147409 
## ... Procrustes: rmse 0.0112789  max resid 0.08844544 
## Run 31 stress 0.1475074 
## ... Procrustes: rmse 0.01333346  max resid 0.0898477 
## Run 32 stress 0.1478596 
## Run 33 stress 0.1472993 
## ... Procrustes: rmse 0.004283632  max resid 0.05498272 
## Run 34 stress 0.1484736 
## Run 35 stress 0.1482754 
## Run 36 stress 0.1476378 
## ... Procrustes: rmse 0.01933188  max resid 0.1218889 
## Run 37 stress 0.1478675 
## Run 38 stress 0.1476816 
## ... Procrustes: rmse 0.007256092  max resid 0.07654745 
## Run 39 stress 0.1488672 
## Run 40 stress 0.1482427 
## Run 41 stress 0.1482503 
## Run 42 stress 0.1472241 
## ... New best solution
## ... Procrustes: rmse 0.001932235  max resid 0.02491834 
## Run 43 stress 0.1485225 
## Run 44 stress 0.1498813 
## Run 45 stress 0.1478506 
## Run 46 stress 0.1482473 
## Run 47 stress 0.1478505 
## Run 48 stress 0.1478506 
## Run 49 stress 0.1477885 
## Run 50 stress 0.1488635 
## Run 51 stress 0.1480955 
## Run 52 stress 0.1479838 
## Run 53 stress 0.148247 
## Run 54 stress 0.147642 
## ... Procrustes: rmse 0.02013675  max resid 0.1417831 
## Run 55 stress 0.1477791 
## Run 56 stress 0.1476386 
## ... Procrustes: rmse 0.02014269  max resid 0.1411722 
## Run 57 stress 0.1478376 
## Run 58 stress 0.1476366 
## ... Procrustes: rmse 0.02008467  max resid 0.1398935 
## Run 59 stress 0.1477258 
## Run 60 stress 0.1473111 
## ... Procrustes: rmse 0.005676916  max resid 0.0757508 
## Run 61 stress 0.1488656 
## Run 62 stress 0.1479689 
## Run 63 stress 0.147652 
## ... Procrustes: rmse 0.019882  max resid 0.1398833 
## Run 64 stress 0.1476399 
## ... Procrustes: rmse 0.02003299  max resid 0.139002 
## Run 65 stress 0.1481721 
## Run 66 stress 0.1482412 
## Run 67 stress 0.1493593 
## Run 68 stress 0.1493694 
## Run 69 stress 0.1487477 
## Run 70 stress 0.1476472 
## ... Procrustes: rmse 0.01260785  max resid 0.1293964 
## Run 71 stress 0.1488716 
## Run 72 stress 0.1478596 
## Run 73 stress 0.1476167 
## ... Procrustes: rmse 0.006229479  max resid 0.07636218 
## Run 74 stress 0.1477052 
## ... Procrustes: rmse 0.009303682  max resid 0.09618332 
## Run 75 stress 0.1475537 
## ... Procrustes: rmse 0.01458862  max resid 0.09027303 
## Run 76 stress 0.1478654 
## Run 77 stress 0.1476396 
## ... Procrustes: rmse 0.02012063  max resid 0.1407968 
## Run 78 stress 0.1473797 
## ... Procrustes: rmse 0.01156493  max resid 0.08887696 
## Run 79 stress 0.1476288 
## ... Procrustes: rmse 0.01946082  max resid 0.1303855 
## Run 80 stress 0.1478377 
## Run 81 stress 0.148258 
## Run 82 stress 0.1488708 
## Run 83 stress 0.1486851 
## Run 84 stress 0.1473641 
## ... Procrustes: rmse 0.006385749  max resid 0.0779665 
## Run 85 stress 0.1479572 
## Run 86 stress 0.1488641 
## Run 87 stress 0.1473808 
## ... Procrustes: rmse 0.01152497  max resid 0.08849104 
## Run 88 stress 0.1502107 
## Run 89 stress 0.1476014 
## ... Procrustes: rmse 0.01885987  max resid 0.1200633 
## Run 90 stress 0.147853 
## Run 91 stress 0.147225 
## ... Procrustes: rmse 0.001203653  max resid 0.01530389 
## Run 92 stress 0.1483518 
## Run 93 stress 0.1473131 
## ... Procrustes: rmse 0.005617756  max resid 0.07306795 
## Run 94 stress 0.1475587 
## ... Procrustes: rmse 0.01049257  max resid 0.1023251 
## Run 95 stress 0.1476265 
## ... Procrustes: rmse 0.01932061  max resid 0.1247804 
## Run 96 stress 0.1483915 
## Run 97 stress 0.1488612 
## Run 98 stress 0.1478565 
## Run 99 stress 0.1490258 
## Run 100 stress 0.1482512 
## Run 101 stress 0.1488695 
## Run 102 stress 0.1476655 
## ... Procrustes: rmse 0.01251478  max resid 0.13848 
## Run 103 stress 0.1472422 
## ... Procrustes: rmse 0.002494852  max resid 0.01920491 
## Run 104 stress 0.1474824 
## ... Procrustes: rmse 0.009127591  max resid 0.0881224 
## Run 105 stress 0.147839 
## Run 106 stress 0.1485395 
## Run 107 stress 0.1478554 
## Run 108 stress 0.1516947 
## Run 109 stress 0.1478487 
## Run 110 stress 0.1474187 
## ... Procrustes: rmse 0.01212465  max resid 0.08884664 
## Run 111 stress 0.1478355 
## Run 112 stress 0.1610461 
## Run 113 stress 0.1476989 
## ... Procrustes: rmse 0.008899706  max resid 0.08909242 
## Run 114 stress 0.1488678 
## Run 115 stress 0.1473363 
## ... Procrustes: rmse 0.00674508  max resid 0.08908845 
## Run 116 stress 0.1475096 
## ... Procrustes: rmse 0.01679961  max resid 0.124777 
## Run 117 stress 0.1482799 
## Run 118 stress 0.1483455 
## Run 119 stress 0.1495422 
## Run 120 stress 0.1478503 
## Run 121 stress 0.1489577 
## Run 122 stress 0.147365 
## ... Procrustes: rmse 0.01123406  max resid 0.08880898 
## Run 123 stress 0.1476199 
## ... Procrustes: rmse 0.006211334  max resid 0.07651768 
## Run 124 stress 0.1478622 
## Run 125 stress 0.1558743 
## Run 126 stress 0.1499354 
## Run 127 stress 0.1486993 
## Run 128 stress 0.147367 
## ... Procrustes: rmse 0.007656135  max resid 0.0948792 
## Run 129 stress 0.1485442 
## Run 130 stress 0.1494129 
## Run 131 stress 0.1474786 
## ... Procrustes: rmse 0.00915178  max resid 0.08337381 
## Run 132 stress 0.1488589 
## Run 133 stress 0.1476417 
## ... Procrustes: rmse 0.02013721  max resid 0.1416759 
## Run 134 stress 0.1478677 
## Run 135 stress 0.1481001 
## Run 136 stress 0.149644 
## Run 137 stress 0.1472951 
## ... Procrustes: rmse 0.0031719  max resid 0.02892864 
## Run 138 stress 0.1475794 
## ... Procrustes: rmse 0.01599062  max resid 0.09043829 
## Run 139 stress 0.1488631 
## Run 140 stress 0.1476282 
## ... Procrustes: rmse 0.01999698  max resid 0.1335971 
## Run 141 stress 0.1493906 
## Run 142 stress 0.1487143 
## Run 143 stress 0.1480024 
## Run 144 stress 0.1480977 
## Run 145 stress 0.1476439 
## ... Procrustes: rmse 0.02037032  max resid 0.1396773 
## Run 146 stress 0.1479813 
## Run 147 stress 0.1482298 
## Run 148 stress 0.1482598 
## Run 149 stress 0.1475631 
## ... Procrustes: rmse 0.0110457  max resid 0.1040098 
## Run 150 stress 0.1493688 
## Run 151 stress 0.1558621 
## Run 152 stress 0.1482623 
## Run 153 stress 0.14927 
## Run 154 stress 0.1479646 
## Run 155 stress 0.1483403 
## Run 156 stress 0.1480465 
## Run 157 stress 0.1474963 
## ... Procrustes: rmse 0.01742518  max resid 0.1316828 
## Run 158 stress 0.1482441 
## Run 159 stress 0.1477645 
## Run 160 stress 0.1481983 
## Run 161 stress 0.1482449 
## Run 162 stress 0.1504534 
## Run 163 stress 0.1475056 
## ... Procrustes: rmse 0.01510194  max resid 0.09849841 
## Run 164 stress 0.1486575 
## Run 165 stress 0.148687 
## Run 166 stress 0.1480975 
## Run 167 stress 0.1476385 
## ... Procrustes: rmse 0.02025962  max resid 0.138872 
## Run 168 stress 0.1495316 
## Run 169 stress 0.1488603 
## Run 170 stress 0.1481157 
## Run 171 stress 0.147841 
## Run 172 stress 0.148778 
## Run 173 stress 0.1483677 
## Run 174 stress 0.1472299 
## ... Procrustes: rmse 0.001881896  max resid 0.01508081 
## Run 175 stress 0.1488624 
## Run 176 stress 0.149037 
## Run 177 stress 0.1475687 
## ... Procrustes: rmse 0.01799899  max resid 0.1323855 
## Run 178 stress 0.1481801 
## Run 179 stress 0.1488658 
## Run 180 stress 0.1474777 
## ... Procrustes: rmse 0.01018975  max resid 0.09644619 
## Run 181 stress 0.147649 
## ... Procrustes: rmse 0.0201017  max resid 0.1404399 
## Run 182 stress 0.1479897 
## Run 183 stress 0.1484493 
## Run 184 stress 0.1476406 
## ... Procrustes: rmse 0.02015337  max resid 0.1414342 
## Run 185 stress 0.1474469 
## ... Procrustes: rmse 0.01627604  max resid 0.1200323 
## Run 186 stress 0.1476485 
## ... Procrustes: rmse 0.01766931  max resid 0.1275618 
## Run 187 stress 0.147629 
## ... Procrustes: rmse 0.01921176  max resid 0.1277295 
## Run 188 stress 0.1479617 
## Run 189 stress 0.1475411 
## ... Procrustes: rmse 0.007082833  max resid 0.08423845 
## Run 190 stress 0.1478458 
## Run 191 stress 0.1472301 
## ... Procrustes: rmse 0.001070434  max resid 0.01152145 
## Run 192 stress 0.1475719 
## ... Procrustes: rmse 0.01812416  max resid 0.1301772 
## Run 193 stress 0.1478348 
## Run 194 stress 0.1488717 
## Run 195 stress 0.1475772 
## ... Procrustes: rmse 0.01096053  max resid 0.1040352 
## Run 196 stress 0.1485018 
## Run 197 stress 0.14745 
## ... Procrustes: rmse 0.01665081  max resid 0.1270779 
## Run 198 stress 0.1476284 
## ... Procrustes: rmse 0.005986012  max resid 0.07631243 
## Run 199 stress 0.1481318 
## Run 200 stress 0.1478354 
## Run 201 stress 0.1487709 
## Run 202 stress 0.148459 
## Run 203 stress 0.1475696 
## ... Procrustes: rmse 0.01801853  max resid 0.1323743 
## Run 204 stress 0.1473517 
## ... Procrustes: rmse 0.00591432  max resid 0.06865051 
## Run 205 stress 0.147501 
## ... Procrustes: rmse 0.01019194  max resid 0.1008233 
## Run 206 stress 0.1472389 
## ... Procrustes: rmse 0.001975834  max resid 0.01501376 
## Run 207 stress 0.147639 
## ... Procrustes: rmse 0.02004943  max resid 0.1342263 
## Run 208 stress 0.1476199 
## ... Procrustes: rmse 0.01876498  max resid 0.1186053 
## Run 209 stress 0.1481048 
## Run 210 stress 0.147236 
## ... Procrustes: rmse 0.001066494  max resid 0.009984632 
## ... Similar to previous best
## *** Solution reached
str(meta.nmds.FloristicSurvey3D)
## List of 35
##  $ nobj      : int 195
##  $ nfix      : int 0
##  $ ndim      : num 3
##  $ ndis      : int 18915
##  $ ngrp      : int 1
##  $ diss      : num [1:18915] 0 0 0 0 0 0 0 0 0 0 ...
##  $ iidx      : int [1:18915] 111 67 111 97 105 112 89 114 115 177 ...
##  $ jidx      : int [1:18915] 103 2 105 56 103 94 55 59 100 118 ...
##  $ xinit     : num [1:585] 0.376 0.603 0.299 0.296 0.619 ...
##  $ istart    : int 1
##  $ isform    : int 1
##  $ ities     : int 1
##  $ iregn     : int 1
##  $ iscal     : int 1
##  $ maxits    : int 200
##  $ sratmx    : num 1
##  $ strmin    : num 1e-04
##  $ sfgrmn    : num 1e-07
##  $ dist      : num [1:18915] 0 0 0 0 0 ...
##  $ dhat      : num [1:18915] 0 0 0 0 0 ...
##  $ points    : num [1:195, 1:3] -0.1448 -0.1579 -0.1309 -0.102 -0.0905 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:195] "7" "7" "7" "7" ...
##   .. ..$ : chr [1:3] "MDS1" "MDS2" "MDS3"
##   ..- attr(*, "centre")= logi TRUE
##   ..- attr(*, "pc")= logi TRUE
##   ..- attr(*, "halfchange")= logi FALSE
##   ..- attr(*, "internalscaling")= num 3.57
##  $ stress    : num 0.147
##  $ grstress  : num 0.147
##  $ iters     : int 96
##  $ icause    : int 3
##  $ call      : language metaMDS(comm = dist_FloristicSurvey, k = 3, trymax = 1000)
##  $ model     : chr "global"
##  $ distmethod: chr "binary bray"
##  $ distcall  : chr "vegdist(x = M, method = \"bray\", binary = T)"
##  $ distance  : chr "binary bray"
##  $ converged : logi TRUE
##  $ tries     : num 210
##  $ engine    : chr "monoMDS"
##  $ species   : logi NA
##  $ data      : chr "dist_FloristicSurvey"
##  - attr(*, "class")= chr [1:2] "metaMDS" "monoMDS"
# stress is lower! 0.146
stressplot(meta.nmds.FloristicSurvey3D)

# envfit for the 2D
FloristicSurvey_envfit <- envfit(meta.nmds.FloristicSurvey2D, env = GM_coverage_df, perm = 999) #standard envfit
FloristicSurvey_envfit
## 
## ***FACTORS:
## 
## Centroids:
##                    NMDS1   NMDS2
## M...52.High       0.0306  0.0250
## M...52.Low       -0.0089 -0.0028
## M...52.Med_High   0.0776 -0.0008
## M...52.Med_Low    0.0566  0.0444
## M...52.None      -0.1409 -0.0359
## M...52.Overtaken  0.1643  0.0624
## 
## Goodness of fit:
##             r2 Pr(>r)    
## M...52. 0.1681  0.001 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Permutation: free
## Number of permutations: 999
#data for plotting 
##NMDS points
FloristicSurvey.NMDS.data<-GM_coverage_df 
FloristicSurvey.NMDS.data$NMDS1<-meta.nmds.FloristicSurvey2D$points[ ,1] 
FloristicSurvey.NMDS.data$NMDS2<-meta.nmds.FloristicSurvey2D$points[ ,2] 
colnames(FloristicSurvey.NMDS.data)[1] <- "GM_Coverage"

# data for the envfit arrows
env.scores.FloristicSurvey <- as.data.frame(scores(FloristicSurvey_envfit, display = "vectors")) #extracts relevant scores from envifit
env.scores.FloristicSurvey <- cbind(env.scores.FloristicSurvey, env.variables = rownames(env.scores.FloristicSurvey)) #and then gives them their names

# function for ellipsess - just run this, is used later
#taken from the excellent stackoverflow Q+A: http://stackoverflow.com/questions/13794419/plotting-ordiellipse-function-from-vegan-package-onto-nmds-plot-created-in-ggplo
veganCovEllipse <- function (cov, center = c(0, 0), scale = 1, npoints = 100) 
{
  theta <- (0:npoints) * 2 * pi/npoints
  Circle <- cbind(cos(theta), sin(theta))
  t(center + scale * t(Circle %*% chol(cov)))
}

#data for ellipse, use GM coverage
df_ell.FSurvey.GM_coverage <- data.frame() #sets up a data frame before running the function.
for(g in levels(FloristicSurvey.NMDS.data$GM_Coverage)){
  df_ell.FSurvey.GM_coverage <- rbind(df_ell.FSurvey.GM_coverage, cbind(as.data.frame(with(FloristicSurvey.NMDS.data [FloristicSurvey.NMDS.data$GM_Coverage==g,],
                                                                                   veganCovEllipse(cov.wt(cbind(NMDS1,NMDS2),wt=rep(1/length(NMDS1),length(NMDS1)))$cov,center=c(mean(NMDS1),mean(NMDS2)))))
                                                                ,GM_coverage=g))
}

# data for labelling the ellipse
NMDS.mean.FloristicSurvey=aggregate(FloristicSurvey.NMDS.data[ ,c("NMDS1", "NMDS2")], 
                         list(group = FloristicSurvey.NMDS.data$GM_Coverage), mean)

## finally plotting.
mult <- 1 #multiplier for the arrows and text for envfit below. You can change this and then rerun the plot command.
FloristicSurvey.nmds.gg1 <- ggplot(data = FloristicSurvey.NMDS.data, aes(y = NMDS2, x = NMDS1))+ #sets up the plot. brackets around the entire thing to make it draw automatically
    geom_path(data = df_ell.FSurvey.GM_coverage, aes(x = NMDS1, y = NMDS2, group = df_ell.FSurvey.GM_coverage$GM_coverage, alpha=df_ell.FSurvey.GM_coverage$GM_coverage))+ #this is the ellipse, seperate ones by Site. If you didn't change the "alpha" (the shade) then you need to keep the "group 
    scale_alpha_manual(guide = FALSE,values=c(0.3, 0.5, 0.6, 0.7, 0.8, 0.9))+ #sets the shade for the ellipse
    geom_point( aes(shape = FloristicSurvey.NMDS.data$GM_Coverage), size = 1) + #puts the site points in from the ordination, shape determined by site, size refers to size of point
    # geom_text(data=spps2, aes(x=spps2$NMDS1, y=spps2$NMDS2, label=species), size = 3.3, hjust=1.1)+ #labelling the species. hjust used to shift them slightly from their points
    #annotate("text",x = NMDS.mean$NMDS1,y = NMDS.mean$NMDS2,label=NMDS.mean$group) + #labels for the centroids - I haven't used this since we have a legend. but you could also dithc the legend, but plot will get v messy
    #geom_segment(data = env.scores.FloristicSurvey,
    #             aes(x = 0, xend = mult*env.scores.FloristicSurvey$NMDS1, y = 0, yend = mult*env.scores.FloristicSurvey$NMDS2),
    #             arrow = arrow(length = unit(0.25, "cm")), colour = "grey") + #arrows for envfit.  doubled the length for similarity to the plot() function. NB check ?envfit regarding arrow length if not familiar with lengths
    #geom_text(data = env.scores.FloristicSurvey, #labels the environmental variable arrows * "mult" as for the arrows
    #          aes(x = mult*env.scores.FloristicSurvey$NMDS1, y = mult*env.scores.FloristicSurvey$NMDS2, label=env.variables),
    #          size = 5,
    #          hjust = -0.5)+
    scale_shape_manual(values = c(1,8,19,5,6,7))+ #sets the shape of the plot points instead of using whatever ggplot2 automatically provides
    coord_cartesian(xlim = c(-1,1.5))+  ## NB this changes the visible area of the plot only (this is a good thing, apparently). Can also specify ylim. Here in case you want to set xaxis manually.
    theme_simple()

Soil Characteristics

Soil_characteristics$Location<-as.factor(Soil_characteristics$Location)
GLmodel_soil <- glm(Location ~Agg_stability*C_percent*N_percent,family=binomial(link='logit'),data=Soil_characteristics)
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
summary(GLmodel_soil)
## 
## Call:
## glm(formula = Location ~ Agg_stability * C_percent * N_percent, 
##     family = binomial(link = "logit"), data = Soil_characteristics)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5019  -0.9103  -0.1493   0.7927   2.1777  
## 
## Coefficients:
##                                   Estimate Std. Error z value Pr(>|z|)
## (Intercept)                         -40.68      40.25  -1.011    0.312
## Agg_stability                        57.36      62.43   0.919    0.358
## C_percent                            28.40      18.23   1.558    0.119
## N_percent                          -178.24     138.30  -1.289    0.197
## Agg_stability:C_percent             -40.73      26.92  -1.513    0.130
## Agg_stability:N_percent             253.80     211.09   1.202    0.229
## C_percent:N_percent                 -14.38      10.04  -1.432    0.152
## Agg_stability:C_percent:N_percent    20.95      15.18   1.380    0.168
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 27.726  on 19  degrees of freedom
## Residual deviance: 18.370  on 12  degrees of freedom
## AIC: 34.37
## 
## Number of Fisher Scoring iterations: 8
Soil_characteristics2 <- data.frame(Soil_characteristics$Population, Soil_characteristics$Location, log(Soil_characteristics$pH), log(Soil_characteristics$Agg_stability), log(Soil_characteristics$C_percent), log(Soil_characteristics$N_percent))
Soil_characteristics2<-rename(Soil_characteristics2, c("Soil_characteristics.Population"="Population", "Soil_characteristics.Location"="Location", "log.Soil_characteristics.pH."="pH", "log.Soil_characteristics.Agg_stability."="Agg_stability", "log.Soil_characteristics.C_percent."="Percent","log.Soil_characteristics.N_percent."="Percent" ))
## Warning: The plyr::rename operation has created duplicates for the
## following name(s): (`Percent`)
df2 <- reshape2::melt(Soil_characteristics2, id.var=c("Population","Location"))
df2 <- rename(df2, c("value"="Log_value"))

p <- ggplot(Soil_characteristics, aes(Location,pH,fill=Location))
p + geom_boxplot() +
  theme_simple()

# Histology data Analysis

Data exploration

Calculate plant-level Mycchorizae, pathogens and herbivory:

# Fix column characteristics for plotting and analysis
fdata$indiv2<-as.factor(fdata$indiv2)
fdata$Mycorrhiza<-as.numeric(paste(fdata$Mycorrhiza))
fdata$Lesion<-as.numeric(paste(fdata$Lesion))
fdata$Herbivory<-as.numeric(paste(fdata$Herbivory))
pct<-function(x){
  sum(x)/100
}

# Calculate plant-level averages
fdat_ind<-aggregate(fdata[,c("Mycorrhiza","Lesion","Herbivory")],by=list(indiv2=fdata$indiv2,pop=fdata$pop,loc=fdata$loc,species=fdata$species), FUN=pct)

Simple linear model visualization:

## Mycorrhiza model (NOTE: No loc*species because not all species present in all populations)
base.Myc<-lmer(Mycorrhiza~species+loc+species:loc+(1|pop)+(1|pop:loc),data=fdat_ind)
noint.Myc<-lmer(Mycorrhiza~species+loc+(1|pop)+(1|pop:loc),data=fdat_ind)
anova(base.Myc,noint.Myc)
## refitting model(s) with ML (instead of REML)
base.Myc ## Inspect coefficients
## Linear mixed model fit by REML ['lmerMod']
## Formula: 
## Mycorrhiza ~ species + loc + species:loc + (1 | pop) + (1 | pop:loc)
##    Data: fdat_ind
## REML criterion at convergence: -12.5748
## Random effects:
##  Groups   Name        Std.Dev.
##  pop:loc  (Intercept) 0.06622 
##  pop      (Intercept) 0.00000 
##  Residual             0.21042 
## Number of obs: 225, groups:  pop:loc, 22; pop, 11
## Fixed Effects:
##    (Intercept)       speciesCL       speciesGA       speciesGR  
##        0.38985        -0.05067         0.03105         0.01338  
##      speciesMR       speciesSC            locO  speciesCL:locO  
##       -0.02840         0.28780         0.15278         0.13277  
## speciesGA:locO  speciesGR:locO  speciesMR:locO  speciesSC:locO  
##       -0.10069         0.23077         0.28893        -0.04707
ggplot(fdat_ind,aes(species,Mycorrhiza,colour=loc))+geom_boxplot()+theme_simple()

ggplot(fdat_ind,aes(pop,Mycorrhiza,colour=loc))+geom_boxplot()+theme_simple()

Mycorrhia model results

  1. Mycorrhiza colonization is significantly higher outside patches of A. petiolata than inside 2a. Species vary in Mycorrhiza colonization, with highest colonization in SC and others relatively similar. 2b. Effect of A. petiolata on Mycorrhiza colonization differs among species, with more pronounced effects for GR and MR, and will little effect for GA
  2. Effect of A. petiolata on Mycorrhiza colonization varies by population, but not as strongly as among species
## Mycorrhiza model (NOTE: No loc*species because not all species present in all populations)
base.Les<-lmer(Lesion~Mycorrhiza*species*loc+(1|pop/loc),data=fdat_ind)
norint.Les<-lmer(Lesion~Mycorrhiza*species*loc+(1|pop),data=fdat_ind)
anova(base.Les,norint.Les)
## refitting model(s) with ML (instead of REML)
norint.Les # inspect coefficients
## Linear mixed model fit by REML ['lmerMod']
## Formula: Lesion ~ Mycorrhiza * species * loc + (1 | pop)
##    Data: fdat_ind
## REML criterion at convergence: -70.9219
## Random effects:
##  Groups   Name        Std.Dev.
##  pop      (Intercept) 0.04934 
##  Residual             0.18543 
## Number of obs: 225, groups:  pop, 11
## Fixed Effects:
##               (Intercept)                 Mycorrhiza  
##                  0.686711                   0.053896  
##                 speciesCL                  speciesGA  
##                 -0.188794                   0.146342  
##                 speciesGR                  speciesMR  
##                  0.090499                  -0.310235  
##                 speciesSC                       locO  
##                 -0.037506                   0.016259  
##      Mycorrhiza:speciesCL       Mycorrhiza:speciesGA  
##                  0.216958                  -0.702730  
##      Mycorrhiza:speciesGR       Mycorrhiza:speciesMR  
##                 -0.020628                   0.559261  
##      Mycorrhiza:speciesSC            Mycorrhiza:locO  
##                  0.136864                  -0.056951  
##            speciesCL:locO             speciesGA:locO  
##                 -0.225004                  -0.389157  
##            speciesGR:locO             speciesMR:locO  
##                 -0.565486                  -0.129568  
##            speciesSC:locO  Mycorrhiza:speciesCL:locO  
##                 -0.007965                   0.098911  
## Mycorrhiza:speciesGA:locO  Mycorrhiza:speciesGR:locO  
##                  0.784046                   0.433494  
## Mycorrhiza:speciesMR:locO  Mycorrhiza:speciesSC:locO  
##                 -0.172551                  -0.051787
Les2<-lmer(Lesion~Mycorrhiza*species*loc-Mycorrhiza:species:loc+(1|pop),data=fdat_ind)
anova(norint.Les,Les2)
## refitting model(s) with ML (instead of REML)
Les3a<-lmer(Lesion~Mycorrhiza*species+Mycorrhiza*loc+(1|pop),data=fdat_ind)
Les3b<-lmer(Lesion~Mycorrhiza*species+species*loc+(1|pop),data=fdat_ind)
Les3c<-lmer(Lesion~species*loc+Mycorrhiza*loc+(1|pop),data=fdat_ind)
anova(norint.Les,Les3a) # TEST species*loc 
## refitting model(s) with ML (instead of REML)
anova(norint.Les,Les3b) # TEST Myc*loc 
## refitting model(s) with ML (instead of REML)
anova(norint.Les,Les3c) # TEST Myc*species
## refitting model(s) with ML (instead of REML)
ggplot(fdat_ind,aes(Mycorrhiza,Lesion))+facet_wrap(~species)+
  geom_point(aes(col=loc))+theme_simple()+geom_smooth(method="lm")

** Lesions model results**

  1. Root lesions increase with mycorrhiza colonization, contrary to predictions
  2. Effect of Mycorrhiza on Lesions depends strongly on species (Myc*species interactions)

Hypothesis 1: Lesion ~ Mycorriza

GIVEN THE NEW ANALYSIS ABOVE, THIS ISN’T WORTHWILE BECAUSE THERE IS NO SIGNIFICANT Myc:species:loc

# calculating the r
indivCODE <- unique(fdata$indiv2)
dfcorr <-data.frame(indivCODE=c(0),r=c(0))
for (i in 1:length(indivCODE)){
  dat1<-NULL
  dat1<-filter(fdata, fdata$indiv2==indivCODE[i])
  dfcorr[i,1] <- indivCODE[i]
  dfcorr[i,2] <- cor(as.numeric(dat1$Mycorrhiza),as.numeric(dat1$Lesion))
}
## Warning in cor(as.numeric(dat1$Mycorrhiza), as.numeric(dat1$Lesion)): the
## standard deviation is zero

## Warning in cor(as.numeric(dat1$Mycorrhiza), as.numeric(dat1$Lesion)): the
## standard deviation is zero

## Warning in cor(as.numeric(dat1$Mycorrhiza), as.numeric(dat1$Lesion)): the
## standard deviation is zero

## Warning in cor(as.numeric(dat1$Mycorrhiza), as.numeric(dat1$Lesion)): the
## standard deviation is zero

## Warning in cor(as.numeric(dat1$Mycorrhiza), as.numeric(dat1$Lesion)): the
## standard deviation is zero

## Warning in cor(as.numeric(dat1$Mycorrhiza), as.numeric(dat1$Lesion)): the
## standard deviation is zero
dfcorr %>% drop_na()->dfcorr

Co-occurence data

#Normal?
car::qqp(dfcorr$r, "norm")
shapiro.test(dfcorr$r)
hist(dfcorr$r)
# Cannot be normal because it is only between -1 and 1 and our mean is at 0.
descdist(dfcorr$r, discrete = FALSE, boot = 500)

# weibull when transformed to be positive?
dfcorr$r.t <- dfcorr$r+1
fit.weibull <- fitdist(dfcorr$r.t, "weibull")
car::qqp(dfcorr$r.t, "weibull", shape = fit.weibull$estimate[[1]])

dfcorr$pop <- gsub("^([0-9]+)[I,O][A-Z]+.*","\\1",dfcorr$indivCODE)
dfcorr$location <- gsub("^[0-9]+([I,O])[A-Z]+.*","\\1",dfcorr$indivCODE)
dfcorr$species <- sub("^[0-9]+[I,O]([A-Z]+).*","\\1",dfcorr$indivCODE)
dfcorr$location <- as.factor(dfcorr$location)
dfcorr$species <- as.factor(dfcorr$species)
dfcorr$pop <- as.factor(dfcorr$pop)

meanR<-mean(dfcorr$r)
SEMR<-sd(dfcorr$r)/sqrt(length(dfcorr$r))
UCI<- meanR+SEMR*1.96
LCI<- meanR-SEMR*1.96
mean(filter(dfcorr, dfcorr$location=="I")$r)
mean(filter(dfcorr, dfcorr$location=="O")$r)


baysian_corrGLMM <- brm(r.t ~ location * species + (1|pop), data=dfcorr, family = weibull(link="log"), control = list(adapt_delta = 0.9))
baysian_corrGLMM2 <- brm(r.t ~ location + species + (1|pop), data=dfcorr, family = weibull(link="log"), control = list(adapt_delta = 0.9))
baysian_corrGLMM3 <- brm(r.t ~ location + (1|pop), data=dfcorr, family = weibull(link="log"), control = list(adapt_delta = 0.9))
baysian_corrGLMM_NULL <- brm(r.t ~ 1 + (1|pop), data=dfcorr, family = weibull(link="log"), control = list(adapt_delta = 0.9))

waic.BCG_1<-waic(baysian_corrGLMM)
waic.BCG_2<-waic(baysian_corrGLMM2)
waic.BCG_3<-waic(baysian_corrGLMM3)
waic.BCG_NULL<-waic(baysian_corrGLMM_NULL)
compare(waic.BCG_1,waic.BCG_2) #positive means second is better
compare(waic.BCG_2,waic.BCG_3) #negative means first is better
compare(waic.BCG_2,waic.BCG_NULL) #negative means first is better
summary(baysian_corrGLMM2)
bayes_R2(baysian_corrGLMM2)


ggplot(dfcorr, aes(y=r,x=location))+geom_boxplot()+theme_simple()
ggplot(dfcorr, aes(y=r,x=species))+geom_boxplot()+theme_simple()

Totals data

# model 
GLMMmyc_lesion <- glmer(binlesion ~ None.Myc * species + (1 | pop) , data = ndatas,family = binomial(link = "logit"))
summary(GLMMmyc_lesion)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: binlesion ~ None.Myc * species + (1 | pop)
##    Data: ndatas
## 
##      AIC      BIC   logLik deviance df.resid 
##   5388.9   5433.4  -2681.5   5362.9      213 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.9159 -3.2800 -0.7426  2.8805 11.6817 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  pop    (Intercept) 0.07038  0.2653  
## Number of obs: 226, groups:  pop, 11
## 
## Fixed effects:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -0.750276   0.090719  -8.270  < 2e-16 ***
## None.Myc           -0.017781   0.038118  -0.466 0.640866    
## speciesCL           0.415585   0.056183   7.397 1.39e-13 ***
## speciesGA           0.444280   0.053486   8.306  < 2e-16 ***
## speciesGR           0.266576   0.073678   3.618 0.000297 ***
## speciesMR           0.146355   0.057804   2.532 0.011344 *  
## speciesSC           0.007849   0.051574   0.152 0.879040    
## None.Myc:speciesCL  0.156587   0.048414   3.234 0.001219 ** 
## None.Myc:speciesGA  0.191932   0.050731   3.783 0.000155 ***
## None.Myc:speciesGR  0.338206   0.069696   4.853 1.22e-06 ***
## None.Myc:speciesMR  0.063131   0.053541   1.179 0.238360    
## None.Myc:speciesSC  0.210590   0.051242   4.110 3.96e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Nn.Myc spcsCL spcsGA spcsGR spcsMR spcsSC N.M:CL N.M:GA
## None.Myc    -0.134                                                        
## speciesCL   -0.369  0.213                                                 
## speciesGA   -0.385  0.223  0.649                                          
## speciesGR   -0.279  0.160  0.466  0.500                                   
## speciesMR   -0.340  0.207  0.572  0.614  0.438                            
## speciesSC   -0.381  0.233  0.627  0.660  0.477  0.588                     
## Nn.Myc:spCL  0.098 -0.786 -0.235 -0.155 -0.110 -0.155 -0.171              
## Nn.Myc:spGA  0.094 -0.750 -0.141 -0.235 -0.116 -0.146 -0.169  0.593       
## Nn.Myc:spGR  0.086 -0.551 -0.142 -0.151 -0.111 -0.128 -0.145  0.431  0.406
## Nn.Myc:spMR  0.090 -0.711 -0.144 -0.148 -0.092 -0.111 -0.159  0.560  0.534
## Nn.Myc:spSC  0.116 -0.750 -0.191 -0.195 -0.145 -0.169 -0.045  0.589  0.555
##             N.M:GR N.M:MR
## None.Myc                 
## speciesCL                
## speciesGA                
## speciesGR                
## speciesMR                
## speciesSC                
## Nn.Myc:spCL              
## Nn.Myc:spGA              
## Nn.Myc:spGR              
## Nn.Myc:spMR  0.394       
## Nn.Myc:spSC  0.429  0.527
options(na.action="na.fail")
dredge(GLMMmyc_lesion)
## Fixed term is "(Intercept)"
r.squaredGLMM(GLMMmyc_lesion)
## The result is correct only if all data used by the model has not changed since model was fitted.
##        R2m        R2c 
## 0.02739802 0.04008648
# will need to change this ASAP

ggplot(data = ndata,aes(x = 1-None.Myc, y = 100-None.Path))+
  stat_summary(fun.y=mean, geom="point")+
  geom_smooth(method = "lm")+
  geom_point()+
  theme_simple()+
  facet_wrap("species")+
  labs(x = "Mycorrhizal colonization", y="Lesions")

Hypothesis 2: Mycorrhiza & Lesion ~ invasion

Does location impact the effect of myc on lesion?

GLMMmyc_lesion_loc <- glmer(binlesion ~ None.Myc * location * species + (1 | pop), data = ndatas, family = binomial(link = "logit"))
summary(GLMMmyc_lesion_loc)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: binlesion ~ None.Myc * location * species + (1 | pop)
##    Data: ndatas
## 
##      AIC      BIC   logLik deviance df.resid 
##   5185.5   5271.0  -2567.7   5135.5      201 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.6366 -3.2043 -0.3462  2.6760 13.6450 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  pop    (Intercept) 0.0698   0.2642  
## Number of obs: 226, groups:  pop, 11
## 
## Fixed effects:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                  -0.725383   0.100890  -7.190 6.49e-13 ***
## None.Myc                     -0.062764   0.054987  -1.141 0.253688    
## locationO                    -0.068081   0.081316  -0.837 0.402458    
## speciesCL                     0.200476   0.081638   2.456 0.014063 *  
## speciesGA                     0.296660   0.077883   3.809 0.000139 ***
## speciesGR                    -1.181296   0.193649  -6.100 1.06e-09 ***
## speciesMR                     0.277361   0.084158   3.296 0.000982 ***
## speciesSC                    -0.021562   0.073106  -0.295 0.768042    
## None.Myc:locationO            0.093031   0.080266   1.159 0.246440    
## None.Myc:speciesCL            0.324299   0.071788   4.517 6.26e-06 ***
## None.Myc:speciesGA            0.189403   0.072737   2.604 0.009216 ** 
## None.Myc:speciesGR           -0.300771   0.187873  -1.601 0.109393    
## None.Myc:speciesMR            0.255496   0.077895   3.280 0.001038 ** 
## None.Myc:speciesSC            0.101743   0.070113   1.451 0.146743    
## locationO:speciesCL           0.398803   0.106396   3.748 0.000178 ***
## locationO:speciesGA           0.301929   0.101835   2.965 0.003028 ** 
## locationO:speciesGR           1.889287   0.212942   8.872  < 2e-16 ***
## locationO:speciesMR          -0.260917   0.111010  -2.350 0.018754 *  
## locationO:speciesSC           0.143608   0.103149   1.392 0.163850    
## None.Myc:locationO:speciesCL -0.282839   0.100392  -2.817 0.004842 ** 
## None.Myc:locationO:speciesGA -0.003347   0.105512  -0.032 0.974693    
## None.Myc:locationO:speciesGR  0.463051   0.207868   2.228 0.025906 *  
## None.Myc:locationO:speciesMR -0.384191   0.109499  -3.509 0.000450 ***
## None.Myc:locationO:speciesSC  0.233745   0.102953   2.270 0.023183 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 24 > 12.
## Use print(x, correlation=TRUE)  or
##   vcov(x)     if you need it
emm<-emmeans(GLMMmyc_lesion_loc, list(~None.Myc| species | location, ~None.Myc| location), type = "response" )
## NOTE: Results may be misleading due to involvement in interactions
summary(emm)
## $`emmeans of None.Myc, location | species`
## species = AH:
##      None.Myc location      prob         SE df  asymp.LCL asymp.UCL
##  1.058488e-16 I        0.3262087 0.02217532 NA 0.28432176 0.3710671
##  1.058488e-16 O        0.3114255 0.02097601 NA 0.27186461 0.3539447
## 
## species = CL:
##      None.Myc location      prob         SE df  asymp.LCL asymp.UCL
##  1.058488e-16 I        0.3717055 0.02222786 NA 0.32927810 0.4162074
##  1.058488e-16 O        0.4516058 0.02288001 NA 0.40727139 0.4967219
## 
## species = GA:
##      None.Myc location      prob         SE df  asymp.LCL asymp.UCL
##  1.058488e-16 I        0.3944313 0.02175155 NA 0.35269620 0.4377651
##  1.058488e-16 O        0.4514349 0.02239380 NA 0.40803107 0.4955905
## 
## species = GR:
##      None.Myc location      prob         SE df  asymp.LCL asymp.UCL
##  1.058488e-16 I        0.1293544 0.02255808 NA 0.09118441 0.1803321
##  1.058488e-16 O        0.4786449 0.02657122 NA 0.42698389 0.5307668
## 
## species = MR:
##      None.Myc location      prob         SE df  asymp.LCL asymp.UCL
##  1.058488e-16 I        0.3898311 0.02331380 NA 0.34521822 0.4363672
##  1.058488e-16 O        0.3149625 0.02075782 NA 0.27576180 0.3569890
## 
## species = SC:
##      None.Myc location      prob         SE df  asymp.LCL asymp.UCL
##  1.058488e-16 I        0.3214874 0.01942629 NA 0.28465376 0.3606841
##  1.058488e-16 O        0.3381795 0.02091737 NA 0.29847025 0.3803078
## 
## Confidence level used: 0.95 
## Intervals are back-transformed from the logit scale 
## 
## $`emmeans of None.Myc | location`
## location = I:
##      None.Myc      prob         SE df asymp.LCL asymp.UCL
##  1.058488e-16 0.3107155 0.01873775 NA 0.2752289 0.3485770
## 
## location = O:
##      None.Myc      prob         SE df asymp.LCL asymp.UCL
##  1.058488e-16 0.3887098 0.01966447 NA 0.3509329 0.4278726
## 
## Results are averaged over the levels of: species 
## Confidence level used: 0.95 
## Intervals are back-transformed from the logit scale
ggplot(data = ndata,aes(x = 1-None.Myc, y = 100-None.Path))+
  geom_smooth(method = "lm")+
  geom_point(aes(color=location))+
  theme_simple()+
  facet_wrap("species")+
  labs(x = "Mycorrhizal colonization", y="Lesions")

pca <- prcomp(ndata[,c(5,9)])
location <- ndata[,13]
g <- ggbiplot(pca, obs.scale = 1, var.scale = 1, 
                groups = location, ellipse = TRUE, 
                circle = TRUE)
g <- g + scale_color_discrete(name = '')
g <- g + theme(legend.direction = 'horizontal', 
                 legend.position = 'top')
print(g)

Does location impact lesion alone?

glmerLESION_disp <- glmer (binlesion ~ location * species + (1|pop) + (1|indiv), data = ndatas, family = binomial(link="logit"))
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge with max|grad| = 0.00135513 (tol =
## 0.001, component 1)
summary(glmerLESION_disp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: binlesion ~ location * species + (1 | pop) + (1 | indiv)
##    Data: ndatas
## 
##      AIC      BIC   logLik deviance df.resid 
##   2011.7   2059.6   -991.8   1983.7      212 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.53231 -0.13210 -0.00971  0.11216  1.14859 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  indiv  (Intercept) 1.11959  1.0581  
##  pop    (Intercept) 0.06426  0.2535  
## Number of obs: 226, groups:  indiv, 226; pop, 11
## 
## Fixed effects:
##                     Estimate Std. Error z value Pr(>|z|)   
## (Intercept)         -0.85482    0.30710  -2.784  0.00538 **
## locationO           -0.10392    0.39475  -0.263  0.79235   
## speciesCL            0.26989    0.39300   0.687  0.49225   
## speciesGA            0.38852    0.37584   1.034  0.30127   
## speciesGR           -0.88023    0.62967  -1.398  0.16214   
## speciesMR            0.38516    0.41882   0.920  0.35776   
## speciesSC           -0.09661    0.35549  -0.272  0.78581   
## locationO:speciesCL  0.45477    0.52759   0.862  0.38870   
## locationO:speciesGA  0.47505    0.50259   0.945  0.34456   
## locationO:speciesGR  1.77188    0.77503   2.286  0.02224 * 
## locationO:speciesMR -0.28686    0.55694  -0.515  0.60651   
## locationO:speciesSC -0.02068    0.48262  -0.043  0.96582   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) loctnO spcsCL spcsGA spcsGR spcsMR spcsSC lcO:CL lcO:GA
## locationO   -0.703                                                        
## speciesCL   -0.741  0.551                                                 
## speciesGA   -0.778  0.579  0.616                                          
## speciesGR   -0.455  0.347  0.354  0.376                                   
## speciesMR   -0.682  0.522  0.539  0.570  0.340                            
## speciesSC   -0.807  0.608  0.637  0.669  0.393  0.588                     
## lctnO:spcCL  0.524 -0.747 -0.716 -0.431 -0.253 -0.390 -0.453              
## lctnO:spcGA  0.566 -0.787 -0.446 -0.727 -0.272 -0.411 -0.488  0.587       
## lctnO:spcGR  0.354 -0.513 -0.273 -0.288 -0.807 -0.269 -0.307  0.378  0.400
## lctnO:spcMR  0.502 -0.709 -0.396 -0.411 -0.250 -0.732 -0.434  0.530  0.558
## lctnO:spcSC  0.575 -0.818 -0.450 -0.473 -0.283 -0.428 -0.721  0.612  0.643
##             lcO:GR lcO:MR
## locationO                
## speciesCL                
## speciesGA                
## speciesGR                
## speciesMR                
## speciesSC                
## lctnO:spcCL              
## lctnO:spcGA              
## lctnO:spcGR              
## lctnO:spcMR  0.366       
## lctnO:spcSC  0.419  0.580
## convergence code: 0
## Model failed to converge with max|grad| = 0.00135513 (tol = 0.001, component 1)
options(na.action="na.fail")
dredge(glmerLESION_disp)
## Fixed term is "(Intercept)"
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge with max|grad| = 0.00135513 (tol =
## 0.001, component 1)
r.squaredGLMM(glmerLESION_disp)
##        R2m        R2c 
## 0.03076813 0.04469034
ggplot(aes(x = location, y = 100-None.Path, color=location), data=ndata)+
  geom_boxplot()+
  geom_jitter(width=0.1)+
  facet_wrap("species")+
  theme_simple()

Does location impact mycorrhiza alone?

glmerMYC_disp <- glmer (binmycorr ~ location * species + (1|pop) + (1|indiv), data = ndata, family = binomial(link="logit"))
summary(glmerMYC_disp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: binmycorr ~ location * species + (1 | pop) + (1 | indiv)
##    Data: ndata
## 
##      AIC      BIC   logLik deviance df.resid 
##   2073.3   2121.2  -1022.7   2045.3      212 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.35863 -0.12130  0.01523  0.09795  1.40036 
## 
## Random effects:
##  Groups Name        Variance  Std.Dev. 
##  indiv  (Intercept) 2.062e+00 1.4361234
##  pop    (Intercept) 1.044e-08 0.0001022
## Number of obs: 226, groups:  indiv, 226; pop, 11
## 
## Fixed effects:
##                      Estimate Std. Error z value Pr(>|z|)  
## (Intercept)          0.121220   0.390387   0.310   0.7562  
## locationO           -0.008745   0.526879  -0.017   0.9868  
## speciesCL           -0.200766   0.515746  -0.389   0.6971  
## speciesGA           -0.375379   0.491194  -0.764   0.4447  
## speciesGR           -1.324367   0.829848  -1.596   0.1105  
## speciesMR           -0.505583   0.551771  -0.916   0.3595  
## speciesSC           -0.954255   0.471189  -2.025   0.0428 *
## locationO:speciesCL  0.053276   0.706272   0.075   0.9399  
## locationO:speciesGA  0.233201   0.669292   0.348   0.7275  
## locationO:speciesGR  0.990565   1.025133   0.966   0.3339  
## locationO:speciesMR -0.245112   0.745205  -0.329   0.7422  
## locationO:speciesSC -0.457001   0.645298  -0.708   0.4788  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) loctnO spcsCL spcsGA spcsGR spcsMR spcsSC lcO:CL lcO:GA
## locationO   -0.741                                                        
## speciesCL   -0.757  0.561                                                 
## speciesGA   -0.795  0.589  0.602                                          
## speciesGR   -0.470  0.349  0.356  0.374                                   
## speciesMR   -0.708  0.524  0.536  0.562  0.333                            
## speciesSC   -0.829  0.614  0.627  0.659  0.390  0.586                     
## lctnO:spcCL  0.553 -0.746 -0.730 -0.439 -0.260 -0.391 -0.458              
## lctnO:spcGA  0.583 -0.787 -0.442 -0.734 -0.274 -0.413 -0.483  0.587       
## lctnO:spcGR  0.381 -0.514 -0.288 -0.303 -0.809 -0.269 -0.316  0.383  0.405
## lctnO:spcMR  0.524 -0.707 -0.396 -0.416 -0.246 -0.740 -0.434  0.527  0.557
## lctnO:spcSC  0.605 -0.816 -0.458 -0.481 -0.285 -0.428 -0.730  0.609  0.643
##             lcO:GR lcO:MR
## locationO                
## speciesCL                
## speciesGA                
## speciesGR                
## speciesMR                
## speciesSC                
## lctnO:spcCL              
## lctnO:spcGA              
## lctnO:spcGR              
## lctnO:spcMR  0.363       
## lctnO:spcSC  0.420  0.577
options(na.action="na.fail")
dredge(glmerMYC_disp)
## Fixed term is "(Intercept)"
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge with max|grad| = 0.0029301 (tol =
## 0.001, component 1)
r.squaredGLMM(glmerMYC_disp)
##       R2m       R2c 
## 0.0410656 0.0410656
ggplot(aes(x = location, y = 100-None.Myc, color=location), data=ndata)+
  geom_boxplot()+
  geom_jitter(width=0.1)+
  facet_wrap("species")+
  theme_simple()

Hypothesis 3 + 4: Lesion ~ Mycorriza * invasion

ggplot(data = ndata,aes(x = 1-None.Myc, y = 100-None.Path, color=location))+
  geom_smooth(method = "lm")+
  geom_point()+
  theme_simple()+
  facet_wrap("species")+
  labs(x = "Mycorrhizal colonization", y="Lesions")

ggplot(data = ndata,aes(x = 1-None.Myc, y = 100-None.Path, color=location))+
  geom_smooth(method = "lm")+
  geom_point()+
  theme_simple()+
  labs(x = "Mycorrhizal colonization", y="Lesions")

Combining histology and field data

Molecular data Analysis

Hypothesis 1: Mycorrhiza_div ~ invasion

Hypothesis 2: Mycorrhiza_div ~ Pathoge_div